Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom words formatting #111

Merged
merged 4 commits into from
Aug 10, 2019

Conversation

alexboche
Copy link

@alexboche alexboche commented Aug 6, 2019

The dragonfly file dictation_format.py provides autoformatting behavior for built-in Dragon vocabulary words with property values which indicate whether there should be for example a space before and/or after the word or whether the next word should be capitalized and things like that. However this does not currently work with custom words in the Dragon vocabulary. Even when you set those properties for your custom words in the Dragon vocabulary (using the word properties GUI or the XML file for your vocabulary), the value of property in dictation_format.py is just blank.

This pull request allows people to set formatting flags for their custom words. Two example customer words are provided (commented out): "len" which is supposed to be a short name for "(" and "ren" which is supposed to be a short name for ")". In order for these to work, they would have to be added to the Dragon vocabulary by the user with (in the case of len) written form "(" and spoken form "len".

I also noticed that the formatting flags for the Dragon built-ins "slash", "open paren", "close paren" were not there, so I added them. There are other Dragon buildings like us but I didn't and them because they are less common and the ones I can think of or just other things that start with open and close (e.g. "open bracket") which are already covered by "left-" and "right-" which are included already.

Note: the autoformatting behavior appears only take into account what is said in the current utterance and does not use information from the previous utterance.
In some ways, this is an important limitation which I discussed in the issue #110

Aside: Perhaps this should be somehow linked up with Natlink functionality for adding custom words, many a time. I don't know how that works. I know Dragon stores vocabulary in text files and XML files and the XML (which are quite messy) files carry a bit more formatting information than the text files (though again that extra formatting information appears to be lost by the time he gets to dragonfly). The Dragon vocabulary text files have just spoken and written forms (and don't allow backslashes in the written forms since that is used as a separator).

@drmfinlay drmfinlay added Dragon NaturallySpeaking Issue related to Dragon NaturallySpeaking engine NatLink Issues related to NatLink labels Aug 7, 2019
@drmfinlay
Copy link
Member

Thanks for adding the missing dictation formatting flags. Improved formatting based on other utterances can be done another PR.

I'm not sure if it would be useful to add custom word functionality to dragonfly when natlink already has functions for it.

@drmfinlay drmfinlay merged commit 5885b08 into dictation-toolbox:master Aug 10, 2019
@LexiconCode LexiconCode added the New Feature A new feature that is distinct from the implemented features label Oct 5, 2019
@drmfinlay
Copy link
Member

@alexboche The if statement you added in this PR has some unfortunate side effects:

""" The if statement below allows users to add the spoken form
# (or the written form if and only if there isn't a spoken form)
# of their own custom Dragon vocabulary words into the property_mapping """
if spoken in self.property_map:
property = spoken

When property is overwritten here, it causes special words with multiple written forms, such as "point" and ".\point\point", to be misinterpreted (see issue #311). This will be removed in the next version of Dragonfly.

I believe custom formatting should be done after this initial formatting or by sub-classing the WordParserDns11 and/or WordFormatter classes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Dragon NaturallySpeaking Issue related to Dragon NaturallySpeaking engine NatLink Issues related to NatLink New Feature A new feature that is distinct from the implemented features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants