concepts.language.ccg.learning.by_parsing_with_lexicon_gen#

by_parsing_with_lexicon_gen(ccg, sentence, lexicon_generator, novel_words=None)[source]#

Learn CCG lexicon entries from a sentence by trying to parse the sentence. Unlike by_parsing(), this function takes a lexicon generator instead of a list of candidate syntax types and semantics.

Parameters:
  • ccg (CCG) – the CCG grammar.

  • sentence (str | list | tuple) – the sentence to be parsed.

  • lexicon_generator (Callable[[str], Iterable[Lexicon]]) – the lexicon generator to be used for generating candidate lexicons. It takes a word as input and returns a list of candidate lexicons.

  • novel_words (tuple | None) – the list of novel words to be learned. If not specified, the algorithm will detect all novel words in the sentence.

Returns:

The result of the learning process, as a list of CCGLearningResult.