-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (21 loc) · 714 Bytes
/
Copy pathtest.py
File metadata and controls
27 lines (21 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
if __name__ == '__main__':
# -- spacy pipeline test
import spacy
from spacy_hunspell import spaCyHunSpell
nlp = spacy.load('en_core_web_sm')
hunspell = spaCyHunSpell(nlp)
nlp.add_pipe(hunspell)
# cheeseburger test
doc = nlp('I can haz cheezeburger.')
haz = doc[2]
assert haz._.hunspell_spell == False
assert haz._.hunspell_suggest[:5] == \
['ha', 'haze', 'hazy', 'has', 'hat']
# unicode test
doc = nlp('I have a \u2033 bottle')
doc = nlp('עקבת אחריו בכל רחבי המדינה.')
doc = nlp(' ł (for example) ')
doc = nlp('He said \u201CHello\u201D')