Skip to content

Commit

Permalink
Fix Issue #683: Add 'SP' to tag_map, if it's not there already, withi…
Browse files Browse the repository at this point in the history
…n the Morphology class.
  • Loading branch information
honnibal committed Dec 18, 2016
1 parent 4e68abe commit 40e7158
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spacy/morphology.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ try:
except ImportError:
import json

from .parts_of_speech cimport ADJ, VERB, NOUN, PUNCT
from .parts_of_speech cimport ADJ, SPACE, VERB, NOUN, PUNCT
from .attrs cimport POS, IS_SPACE
from .parts_of_speech import IDS as POS_IDS
from .lexeme cimport Lexeme
Expand Down Expand Up @@ -48,6 +48,9 @@ cdef class Morphology:
self.reverse_index = {}

self.rich_tags = <RichTagC*>self.mem.alloc(self.n_tags, sizeof(RichTagC))
# Add the 'SP' tag to the map, if it's not there already. See Issue #683.
if 'SP' not in tag_map:
tag_map['SP'] = {POS: SPACE}
for i, (tag_str, attrs) in enumerate(sorted(tag_map.items())):
attrs = _normalize_props(attrs)
attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
Expand Down

0 comments on commit 40e7158

Please sign in to comment.