Skip to content

dict phrases with option to concat the words into one literal #434

Closed

Description

@dehilsterlexis

It seems that there should be a way for specifying phrases in the dictionary that don't end up reduced or can be concatenated into a literal of the phrase words. @amnonma, what do you think?

Activity

  1. amnonma commented on May 21, 2023

    @amnonma
    Contributor

    Sounds good in principle.
    If it means modifying the input buffer, that can get expensive and tricky.
    NLP++ could create a new type of "glommed literal", I suppose that could work internally.
    Would want to flag with a "glommed" attribute, etc.
    I imagine you'd want to get of any whitespace in the concatenated resulting token, and adjust the start and end offset of the literal accordingly.
    @dehilsterlexis

  2. amnonma commented on May 21, 2023

    @amnonma
    Contributor

    @dehilsterlexis
    Since we're speaking of such things, the dictionary or phrasal dictionary might be a good place to split words.
    Eg,
    resultsspeed => results speed
    Do that in a phrasal dict and then you can look up the split words in a follow-on dictionary.
    Ordering these "pre tokenizer" items in this way would simplify the rules-based analyzer that follows.
    Could be powerful with this type of ordering:

    1. splitting dict
    2. concatenation dict
    3. phrasal dict
    4. normal dict
  3. amnonma commented on May 21, 2023

    @amnonma
    Contributor

    @dehilsterlexis
    It's actually easy to concatenate with an NLP++ rule.
    If you use nodetreetext(node) and nodestreetext(node1,nodeN), these know to look for an attribute called "text" and NOT TRAVERSE beneath nodes that have that attribute. You really should try these instead of $text, $treetext, and so on.
    They should become built-in functions.

    @post
    S("text") = "hotrod";
    single();
    @rules
    _hotrod <- _hot _rod @@

  4. dehilsterlexis commented on May 22, 2023

    @dehilsterlexis
    ContributorAuthor

    @amnonma we could even try to implement a word splitter into the mix somehow as part of the tokenizer.

  5. added a commit that references this issue on Oct 15, 2026
  6. ddehilster commented on Oct 15, 2026

    @ddehilster
    Member

    Done in #786 (4.2.30): hot - rod join=1 turns the phrase into one token, hotrod, spanning the same text (whitespace and punctuation dropped). The joined token is then looked up itself, so hotrod s=vehicle applies. Docs: VisualText/visualtext-files#242.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions