Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:51:04+00:00 2026-05-27T20:51:04+00:00

After downloading the trunk code from http://code.google.com/p/berkeleyaligner/ , I added the project into my

  • 0

After downloading the trunk code from http://code.google.com/p/berkeleyaligner/, I added the project into my build path on Eclipse. Then with the code below i can extract the alignments for each sentence pair that i’ve read from the sourceFile and targetFile.
After the alignment, how to read the Alignment type from the BerkeleyAligner?

import edu.berkeley.nlp.wa.mt.Alignment;
import edu.berkeley.nlp.wa.mt.SentencePair;
import edu.berkeley.nlp.wordAlignment.combine.WordAlignerCombined;
public static void main(String[] args) {
BufferedReader brSrc = new BufferedReader(new FileReader ("sourceFile"));
BufferedReader brTrg = new BufferedReader(new FileReader ("targetFile"));
while ((currentSrcLine = brSrc.readLine()) !=null) {
    String currentTrgLine = brTrg.readline();
    // Reads into BerkeleyAligner SentencePair format.
    SentencePair src2trg = new SentencePair(sentCounter, params.get("source"),
        Arrays.asList(srcLine.split(" ")), Arrays.asList(trgLine.split(" ")));
    // Generate Alignment type from SentencePair
    WordAlignerCombined aligner;
    Alignment alignedPair = aligner.alignSentencePair(src2trg);
    // How do i print out the Alignment???
    }
}

e.g. sourceFile:

this is the first line in the textfile.
that is the second line.
foo bar likes to eat bar foo.

e.g. targetFile:

Dies ist die erste Textzeile in der Datei.
das ist die zweite Zeile.
foo bar gerne bar foo essen.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:51:05+00:00Added an answer on May 27, 2026 at 8:51 pm

    Print the GIZA. Alignment has a method for that:

    public void writeGIZA(PrintWriter out, int idx)
    

    GIZA is:

    "# sentence pair (%d) source length %d target length %d alignment score : 0\n"
    "NULL ({ %s })"
    " %s ({ %s })" (englishSentence.get(i), StrUtils.join(alignments))
    

    idx is just the sentence pair id.

    out is just where you want to print it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is the code to write to a file after downloading an image from
After downloading files from a remote UNIX FTP server, you want to verify that
i want to display a image after downloading that image from a web-server i
I just installed git 1.6.4.4 after downloading a DMG package from here . I
hi im doing an openGL project but after downloading and installing the glut library
Here i want to update my device fireware. After downloading the file from somewhere(server)
I am downloading some contents from the server and after sometimes the screen is
Possible Duplicate: Not able to launch android emulator After downloading Eclipse indigo, and updating
After downloading all .NET framework symbols and sources using NetMassDownloader , is it possible
I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.