| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -437,6 +437,16 @@ RUN pip install bcolz && \ | |||
| 437 | 437 | pip install torchtext && \ | |
| 438 | 438 | /tmp/clean-layer.sh | |
| 439 | 439 | ||
| 440 | + # allennlp and dependencies | ||
| 441 | + # TODO: install deps when underlying dependency is fixed. https://github.com/Kaggle/docker-python/issues/548 | ||
| 442 | + RUN pip install jsonnet overrides tensorboardX && \ | ||
| 443 | + pip install flask>=1.0.2 flask-cors>=3.0.7 gevent>=1.3.6 && \ | ||
| 444 | + pip install unidecode parsimonious>=0.8.0 sqlparse>=0.2.4 word2number>=1.1 && \ | ||
| 445 | + pip install pytorch-pretrained-bert>=0.6.0 jsonpickle && \ | ||
| 446 | + pip install requests>=2.18 editdistance conllu==0.11 && \ | ||
| 447 | + pip install --no-dependencies allennlp && \ | ||
| 448 | + /tmp/clean-layer.sh | ||
| 449 | + | ||
| 440 | 450 | ########### | |
| 441 | 451 | # | |
| 442 | 452 | # NEW CONTRIBUTORS: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + import unittest | ||
| 2 | + | ||
| 3 | + from allennlp.data.tokenizers import WordTokenizer | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + class TestAllenNlp(unittest.TestCase): | ||
| 7 | + # reference | ||
| 8 | + # https://github.com/allenai/allennlp/blob/master/allennlp/tests/data/tokenizers/word_tokenizer_test.py | ||
| 9 | + def test_passes_through_correctly(self): | ||
| 10 | + tokenizer = WordTokenizer(start_tokens=['@@', '%%'], end_tokens=['^^']) | ||
| 11 | + sentence = "this (sentence) has 'crazy' \"punctuation\"." | ||
| 12 | + tokens = [t.text for t in tokenizer.tokenize(sentence)] | ||
| 13 | + expected_tokens = ["@@", "%%", "this", "(", "sentence", ")", "has", "'", "crazy", "'", "\"", | ||
| 14 | + "punctuation", "\"", ".", "^^"] | ||
| 15 | + assert tokens == expected_tokens | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments