Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Autocapitalize/correct two connected words?

+0
−0

Let's say I have a character in my story simply called "Slime Monster". With every instance of these two words, I want both words to be capitalized and to be corrected as a pair, so if I mistype it to something like "Silme Mosnter" it will recognize the correct spelling as "Slime Monster".

Is there a way to set up the dictionary like that? I'm using the Windows version (Version 1.9.9.0).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

This post was sourced from https://writers.stackexchange.com/q/43706. It is licensed under CC BY-SA 3.0.

0 comment threads

1 answer

+1
−0

Two possible approaches.

  1. Before you start typing your text. You can set up a list of auto-complete words. From Project -> Project Settings -> autocomplete.

  2. After you typed. You can use the find command in Edit -> Find. Set the Find Options to Regular Expressions (regex). Place the desired Regular expression in the top box, and Slime Monster in the lower box. Make sure you tick the ignore case box and you are good to go. If you are worried that the regex will have false positives, you can click on Next and only replace those occurrences that look wrong.

A bit on Regex.

This requires some knowledge of what regex can do. The one fitting your request could be a search for the two words containing the letters of Slime and Monster.

\b[slime]+\b \b[monster]+\b

Note that this will also match any pair of words whose letters are included in slime and in monster, e.g. "me so" and "see soon"

A bit more complex regex, which is also more accurate, could be:

\b(?=\b(?:[^slime]*[slime]){4,6}[^slime]*\b)[slime]{4,6}\b \b(?=\b(?:[^monster]*[monster]){5,8}[^monster]*\b)[monster]{5,8}\b

[slime]{4,6} tries to match any word made from the letters in slime, with length between 4 and 6. The whole thing tries to match a pair of words, the first of which is between 4 and 6 letters and is composed only of letters from "slime", and the second is between 5 and 8 letters and is composed only of the letters found in "monster". Note that there is a space in between the two, which is also used in the matching.

As written above, do not forget to check the ignore case if you want to correct the capitalization as well.

This answer was inspired by the excellent SO answer: https://stackoverflow.com/questions/4389644/regex-to-match-string-containing-two-names-in-any-order

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »