Exemplo n.º 1
0
 def from_token(token: Token) -> 'MarkovWord':
     if CapitalizationMode.from_token(
             token,
             CAPITALIZATION_COMPOUND_RULES) == CapitalizationMode.COMPOUND:
         compound = True
     else:
         compound = False
     return MarkovWord(token.text,
                       Pos.from_token(token),
                       compound=compound,
                       neighbors={})
Exemplo n.º 2
0
 def from_token(token: Token) -> 'MarkovNeighbor':
     key = token.text.lower()
     text = token.text
     if CapitalizationMode.from_token(token, CAPITALIZATION_COMPOUND_RULES) == CapitalizationMode.COMPOUND:
         compound = True
     else:
         compound = False
     pos = Pos.from_token(token)
     values = [0, 0]
     dist = [0] * (MARKOV_WINDOW_SIZE * 2 + 1)
     return MarkovNeighbor(key, text, pos, compound, values, dist)
Exemplo n.º 3
0
 def from_token(token: Token) -> 'MarkovNeighbor':
     key = token.text.lower()
     text = token.text
     if CapitalizationMode.from_token(token, CAPITALIZATION_COMPOUND_RULES) == CapitalizationMode.COMPOUND:
         compound = True
     else:
         compound = False
     pos = Pos.from_token(token)
     values = [0, 0]
     dist = [0] * (MARKOV_WINDOW_SIZE * 2 + 1)
     return MarkovNeighbor(key, text, pos, compound, values, dist)
Exemplo n.º 4
0
 def from_token(token: Token) -> 'MarkovWord':
     if CapitalizationMode.from_token(token, CAPITALIZATION_COMPOUND_RULES) == CapitalizationMode.COMPOUND:
         compound = True
     else:
         compound = False
     return MarkovWord(token.text, Pos.from_token(token), compound=compound, neighbors={})
Exemplo n.º 5
0
 def analyze(token: Token, mode: CapitalizationMode):
     pos = Pos.from_token(token)
     mode = PoSCapitalizationMode(pos, mode)
     return mode.to_embedding()
Exemplo n.º 6
0
 def analyze(token: Token, mode: CapitalizationMode):
     pos = Pos.from_token(token)
     mode = PoSCapitalizationMode(pos, mode)
     return mode.to_embedding()