Skip to content

Commit

Permalink
support both python 2 and 3 in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
vrasneur committed Oct 4, 2017
1 parent d952f2e commit 3effd36
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/test_lid.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import the pyfasttext module
Load the language identification model
>>> model = FastText(model_file)

Utility function
>>> def print_lang(model, sentence):
... print(model.predict_single(sentence)[0])

Test the model
>>> model.predict_single('les roses sont belles')
[u'fr']
>>> print_lang(model, 'les roses sont belles')
fr

>>> model.predict_single('the roses are beautiful')
[u'en']
>>> print_lang(model, 'the roses are beautiful')
en

0 comments on commit 3effd36

Please sign in to comment.