blob: 20b141249b6dc53b9c2e395dc649134cfe38f2de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# table['some French string'] = [Array of English strings]
def read_phrase_table fn
table = {}
f = ReadFile.new fn
while raw_rule = f.gets
french, english, features = splitpipe(raw_rule)
feature_map = read_feature_string(features)
if table.has_key? french
table[french] << [english, feature_map ]
else
table[french] = [[english, feature_map]]
end
end
f.close
return table
end
|