summaryrefslogtreecommitdiff
path: root/python/pkg/cdec/sa/extractor.py
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2012-09-06 11:17:00 +0100
committerVictor Chahuneau <vchahune@cs.cmu.edu>2012-09-06 11:17:00 +0100
commitaf8b109ad49222bc56527e5e75b8267134233bd4 (patch)
treeced5356aa5b8932686b02ecba864397bf8c0ccb9 /python/pkg/cdec/sa/extractor.py
parentb674c40505f48bfc3aafe4df9e116321c89342fa (diff)
[cdec.sa] Make list of word ids <-> sentence string mapping easy
Diffstat (limited to 'python/pkg/cdec/sa/extractor.py')
-rw-r--r--python/pkg/cdec/sa/extractor.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/pkg/cdec/sa/extractor.py b/python/pkg/cdec/sa/extractor.py
index 940544fb..94392c30 100644
--- a/python/pkg/cdec/sa/extractor.py
+++ b/python/pkg/cdec/sa/extractor.py
@@ -75,7 +75,6 @@ class GrammarExtractor:
def grammar(self, sentence):
if isinstance(sentence, unicode):
sentence = sentence.encode('utf8')
- cnet = chain(('<s>',), sentence.split(), ('</s>',))
- cnet = (cdec.sa.sym_fromstring(word, terminal=True) for word in cnet)
- cnet = tuple(((word, None, 1), ) for word in cnet)
+ words = chain(('<s>',), sentence.split(), ('</s>',))
+ cnet = cdec.sa.make_lattice(words)
return self.factory.input(cnet)