Esempio n. 1
0
def translate(source):
    t = PartOfSpeechTagger('http://text-processing.com/api/tag/', 'text')
    source = expand_contractions(source)
    source = t.tag(source)
    source = source.replace('\n','')
    logging.warning("Foo: " + source)
    sentences = source.split(')(')

    translated = ""
    for pos_tagged in sentences:
        s = Sentence(pos_tagged)
        apply_yodish_grammar(s)
        translated += s.render() + ' '
    return translated.strip()
Esempio n. 2
0
def translate(source):
    t = PartOfSpeechTagger('http://text-processing.com/api/tag/', 'text')
    source = expand_contractions(source)
    source = t.tag(source)
    source = source.replace('\n', '')
    logging.warning("Foo: " + source)
    sentences = source.split(')(')

    translated = ""
    for pos_tagged in sentences:
        s = Sentence(pos_tagged)
        apply_yodish_grammar(s)
        translated += s.render() + ' '
    return translated.strip()
Esempio n. 3
0
 def test_expand_contractions(self):
     actual = expand_contractions("can't ain't i'm you're")
     self.assertEqual("cannot am not I am you are", actual)
Esempio n. 4
0
 def test_expand_contractions(self):
     actual = expand_contractions("can't ain't i'm you're")
     self.assertEqual("cannot am not I am you are", actual)