concepts.language.ccg.learning.by_parsing#

by_parsing(ccg, sentence, *, novel_words=None, candidate_syntax_types=None, syntax_searcher=None, syntax_searcher_kwargs=None, candidate_semantics=None, semantics_searcher=None, semantics_searcher_kwargs=None, bind_concepts=True)[source]#

Learn CCG lexicon entries from a sentence by trying to parse the sentence.

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

  • sentence (str | Iterable[str]) – the sentence to be parsed.

  • 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.

  • candidate_syntax_types (List[CCGSyntaxSearchResult] | None) – the list of candidate syntax types to be used for parsing. If not specified, the algorithm will use the syntax searcher to generate the candidate syntax types.

  • syntax_searcher (CCGSyntaxSearcherBase | None) – the syntax searcher to be used for generating candidate syntax types. If not specified, the algorithm will use the enumerative searcher.

  • syntax_searcher_kwargs (dict | None) – the keyword arguments for the syntax searcher.

  • candidate_semantics (List[CCGSemanticsSearchResult] | None) – the list of candidate semantics to be used for parsing. If not specified, the algorithm will use the semantics searcher to generate the candidate semantics.

  • semantics_searcher (CCGSemanticsSearcherBase | None) – the semantics searcher to be used for generating candidate semantics. If not specified, the algorithm will use the enumerative searcher.

  • semantics_searcher_kwargs (dict | None) – the keyword arguments for the semantics searcher.

  • bind_concepts (bool) – whether to bind concepts in the semantics. This will allow algorithm to invent novel concepts while learning.

Returns:

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

Return type:

List[CCGLearningResult]