src/yang/weiwei/mtm/MTM.java
/**
	 * Read word translation dictionary
	 * @param associationFileName Word translation dictionary file name
	 * @throws IOException IOException
	 */
Read word translation dictionary
@param associationFileName Word translation dictionary file name
@throws IOException IOException
Read word translation dictionary @param associationFileName Word translation dictionary file name @throws IOException IOException
public void readWordAssociations(String associationFileName) throws IOException
	{
		BufferedReader br=new BufferedReader(new FileReader(associationFileName));
		String line,seg[];
		while ((line=br.readLine())!=null)
		{
			seg=line.split("\t");
			int lang1=Integer.valueOf(seg[0]);
			int v1=param.vocab[lang1].getID(seg[1]);
			int lang2=Integer.valueOf(seg[2]);
			int v2=param.vocab[lang2].getID(seg[3]);
			if (v1==-1 || v2==-1 || lang1==lang2) continue;
			if (wordTf[lang1][v1]<=param.wordTfThreshold[lang1] || wordTf[lang2][v2]<=param.wordTfThreshold[lang2]) continue;
			if (wordLinks.get(lang1).get(lang2).get(v1).contains(v2)) continue;
			if (wordLinks.get(lang2).get(lang1).get(v2).contains(v1)) continue;
			numWordLinks++;
			wordLinks.get(lang1).get(lang2).get(v1).add(v2);
			wordLinks.get(lang2).get(lang1).get(v2).add(v1);
			numLangWordLinks[lang1][lang2]++;
			numLangWordLinks[lang2][lang1]++;
		}
		br.close();
	}
public void readWordAssociations ( String associationFileName ) throws IOException { BufferedReader br = new BufferedReader ( new FileReader ( associationFileName ) ) ; String line , seg [ ] ; while ( ( line = br . readLine ( ) ) != null ) { seg = line . split ( "\t" ) ; int lang1 = Integer . valueOf ( seg [ 0 ] ) ; int v1 = param . vocab [ lang1 ] . getID ( seg [ 1 ] ) ; int lang2 = Integer . valueOf ( seg [ 2 ] ) ; int v2 = param . vocab [ lang2 ] . getID ( seg [ 3 ] ) ; if ( v1 == - 1 || v2 == - 1 || lang1 == lang2 ) continue ; if ( wordTf [ lang1 ] [ v1 ] <= param . wordTfThreshold [ lang1 ] || wordTf [ lang2 ] [ v2 ] <= param . wordTfThreshold [ lang2 ] ) continue ; if ( wordLinks . get ( lang1 ) . get ( lang2 ) . get ( v1 ) . contains ( v2 ) ) continue ; if ( wordLinks . get ( lang2 ) . get ( lang1 ) . get ( v2 ) . contains ( v1 ) ) continue ; numWordLinks ++ ; wordLinks . get ( lang1 ) . get ( lang2 ) . get ( v1 ) . add ( v2 ) ; wordLinks . get ( lang2 ) . get ( lang1 ) . get ( v2 ) . add ( v1 ) ; numLangWordLinks [ lang1 ] [ lang2 ] ++ ; numLangWordLinks [ lang2 ] [ lang1 ] ++ ; } br . close ( ) ; }
Read word translation dictionary
 @param associationFileName Word translation dictionary file name
 @throws IOException IOException
Read word translation dictionary @param associationFileName Word translation dictionary file name @throws IOException IOException