mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
* Send beam_width < 0 to greedy parser
This commit is contained in:
parent
0114e7600d
commit
88ac5c6e98
|
@ -83,14 +83,14 @@ cdef class Parser:
|
||||||
def __call__(self, Tokens tokens):
|
def __call__(self, Tokens tokens):
|
||||||
if tokens.length == 0:
|
if tokens.length == 0:
|
||||||
return 0
|
return 0
|
||||||
if self.cfg.beam_width == 1:
|
if self.cfg.beam_width <= 1:
|
||||||
self._greedy_parse(tokens)
|
self._greedy_parse(tokens)
|
||||||
else:
|
else:
|
||||||
self._beam_parse(tokens)
|
self._beam_parse(tokens)
|
||||||
|
|
||||||
def train(self, Tokens tokens, GoldParse gold):
|
def train(self, Tokens tokens, GoldParse gold):
|
||||||
self.moves.preprocess_gold(gold)
|
self.moves.preprocess_gold(gold)
|
||||||
if self.cfg.beam_width == 1:
|
if self.cfg.beam_width <= 1:
|
||||||
return self._greedy_train(tokens, gold)
|
return self._greedy_train(tokens, gold)
|
||||||
else:
|
else:
|
||||||
return self._beam_train(tokens, gold)
|
return self._beam_train(tokens, gold)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user