Exemplo n.º 1
0
 def apply_rule(words, constraints):
     assert len(words) == 1
     word = words[0].lower().replace('_', "")
     subs = set([])
     if len(word) <= 1:
         return subs
     subs.add(word[1:])
     subs.add(word[-1:])
     return bigram_filter(subs, constraints)
Exemplo n.º 2
0
 def apply_rule(words, constraints):
     assert len(words) == 1
     word = words[0].lower().replace('_', "")
     subs = set([])
     if len(word) <= 1:
         return subs
     subs.add(word[1:])
     subs.add(word[-1:])
     return bigram_filter(subs, constraints)
Exemplo n.º 3
0
 def apply_rule(words, constraints):
     assert len(words) == 1
     word = words[0].lower().replace('_', "")
     length = sum(constraints.lengths)
     subs = set([])
     if len(word) <= 1:
         return subs
     for l in range(1, min(len(word), length + 1, 4)):
         subs.add(word[:l])
     if len(word) > 2:
         subs.add(word[:len(word)-1])
     return bigram_filter(subs, constraints)
Exemplo n.º 4
0
 def apply_rule(words, constraints):
     assert len(words) == 1
     word = words[0].lower().replace('_', "")
     length = sum(constraints.lengths)
     subs = set([])
     if len(word) <= 1:
         return subs
     for l in range(1, min(len(word), length + 1, 4)):
         subs.add(word[:l])
     if len(word) > 2:
         subs.add(word[:len(word) - 1])
     return bigram_filter(subs, constraints)