Add hyphenation to dictionary

Discuss the word processor
Post Reply
greyinblue
Posts: 16
Joined: Wed Mar 07, 2018 3:14 pm

Add hyphenation to dictionary

Post by greyinblue »

I can add words to my standard dictionary, I can add conditional hyphens to my text. But how do I add this to the dictionary such that the auto-hyphenation always splits words at the designated position?
For instance, I regularly generate lists of names from a database. How do I tell OpenOffice always to hyphenate at "Mac-Leod"?
Thanks
AOO 4.1.7 and LO 7.1, Windows 10
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add hyphenation to dictionary

Post by RoryOF »

For a start, I would increase the minimum character settings for hyphenation (characters at end/beginning of line) in your files to at least 3. You should be able to incorporate these settings into your default template.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add hyphenation to dictionary

Post by RoryOF »

The dictionaries used in OpenOffice are Hunspell dictionaries. You may need to generate an AFFIX file to specify details, including hyphenation, about the word(s) you have added. Some information (too much?) on this is at

http://manpages.ubuntu.com/manpages/tru ... ell.4.html

That this information is on a linux site need not be concerning, as the AFFIX file is plain text and operating system independent.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
greyinblue
Posts: 16
Joined: Wed Mar 07, 2018 3:14 pm

Re: Add hyphenation to dictionary

Post by greyinblue »

Thanks for the swift reply. I worked my way through the page you gave, but the rules for breaking words there are only intended as rules for the spellchecker in split words. My question is a bit different. I had imagined I could set a manual hyphen in my text and have Writer's standard dictionary learn that I always want it split at that position, similarly to the way Writer will add all words I type to the dictionary if I ask it to.
AOO 4.1.7 and LO 7.1, Windows 10
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add hyphenation to dictionary

Post by RoryOF »

There may be more information on the hunspell site.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Add hyphenation to dictionary

Post by John_Ha »

Does a conditional hyphen do what you want. See Chapter 3 - Working with text which says
Manual hyphenation
To manually hyphenate words, do not use a normal hyphen, which will remain visible even if the word is no longer at the end of a line when you add or delete text or change margins or font size. Instead, use a conditional hyphen, which is visible only when required.
To insert a conditional hyphen inside a word, click where you want the hyphen to appear and press Control+hyphen. The word will be hyphenated at this position when it is at the end of the line, even if automatic hyphenation for this paragraph is switched off.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
greyinblue
Posts: 16
Joined: Wed Mar 07, 2018 3:14 pm

Re: Add hyphenation to dictionary

Post by greyinblue »

My list contains names such as MacLeod, Robertson, etc. The dictionary doesn't recognise these "words". I can add them to my dictionary, however, they will still not be hyphenated because the dictionary doesn't know where. I'd like to add that information.
To answer your question, yes, the conditional hyphen is currently my only known method to add the information at the moment, however I have to do it for each and every occurrence of each name in the file. And that every time I start a new name report.
AOO 4.1.7 and LO 7.1, Windows 10
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add hyphenation to dictionary

Post by RoryOF »

You can, in any Writer file, select those of your dictionaries you require. So your Name dictionary need only be built once. I have no information on where the conditional hyphenation information is stored.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Add hyphenation to dictionary

Post by John_Ha »

Look for your dictionary.

It looks like my UK English hyphenation information is in C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\uno_packages\cache\uno_packages\svd8sw.tmp_\dict-en-20171101.oxt\hyph_en_GB.dic.
Attachments
Clipboard01.gif
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
greyinblue
Posts: 16
Joined: Wed Mar 07, 2018 3:14 pm

Re: Add hyphenation to dictionary

Post by greyinblue »

Yes, mine is identical to yours. But where do I add the hyphenation information? Also, opening it in UTF-8 I don't even recognise the words.
AOO 4.1.7 and LO 7.1, Windows 10
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add hyphenation to dictionary

Post by RoryOF »

In that same directory should be a README_en_~GB.txt file. (or similar name).
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
greyinblue
Posts: 16
Joined: Wed Mar 07, 2018 3:14 pm

Re: Add hyphenation to dictionary

Post by greyinblue »

Thanks for the tip. I found a file called "README_hyph_en_GB.txt" but that says nothing about how end users can modify hyphenation information.
It seems odd that I can add words to the dictionary willy nilly, and yet not tell writer where to hyphenate them. Oh well.
AOO 4.1.7 and LO 7.1, Windows 10
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add hyphenation to dictionary

Post by RoryOF »

There is a paper on hyphenation on OpenOffice.org (an earlier version of OO) at
http://hunspell.sourceforge.net/tb87nemeth.pdf
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Add hyphenation to dictionary

Post by John_Ha »

The dictionary above is the standard AOO UK English dictionary. It cannot be edited or changed or modified by AOO - AOO merely reads it.

If you add a word like zebb so it is not flagged as misspelled, then zebb is stored in C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\wordbook\standard.dic. The file ...\standard.dic is a flat text file and cannot store conditional hyphens. If you do not care that MacLeod is flagged as misspelled then you can ignore C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\wordbook\standard.dic
I can add words to my standard dictionary, I can add conditional hyphens to my text. But how do I add this to the dictionary such that the auto-hyphenation always splits words at the designated position?
For instance, I regularly generate lists of names from a database. How do I tell OpenOffice always to hyphenate at "Mac-Leod"?
I think therefore you probably need to "hack" C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\uno_packages\cache\uno_packages\svd8sw.tmp_\dict-en-20171101.oxt\hyph_en_GB.dic such that you include a line in it which hyphenates after Mac. You therefore need to understand the syntax of the hyphenation file so you can hack it. It probably has to stay in alphabetical order.

Be aware that this is not a standard or a supported way of doing things. Any edit to the file MUST maintain the consistency of the file. Whenever the dictionary is updated normally your carefully edited file will almost certainly be replaced with a new, updated standard file.

Another way would be to write a macro which replaced MacLeod with Mac[conditional hyphen]Leod and have entries for each name. You would maintain a list of "Macleod" "Mac[conditional hyphen]Leod" for each name and the macro would run down the list doing the replacements. Obviously, if you can specify by rules where you want the hyphen, you could use a regular expression search for each rule. eg Find "Mac followed by any letter" and replace it with "Mac[conditional hyphen]".

Try and see if AutoCorrect will do it - paste Mac[conditional hyphen]Leod into the Replace field. Does it work? EDIT: AutoCorrect does store the conditional hyphen when I paste it into With.

Can you do a "brute force and ignorance" method by creating an extra "hyphen" field in the database with Mac%%Leod. Use this field to bring in the name and run a macro to change %% to a conditional hyphen after bringing in the name. See [Tutorial] How to record a macro (and Regular Expressions) for ideas and the Macros and UNO API forum.

Could you store Mac[conditional hyphen}Leod in the database so it is brought into Writer? Try pasting it in - does it work?

I don't think AutoHotKey will do it because it only corrects as you type and you are not typing MacLeod.
Attachments
Clipboard01.gif
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
greyinblue
Posts: 16
Joined: Wed Mar 07, 2018 3:14 pm

Re: Add hyphenation to dictionary

Post by greyinblue »

Thanks both again. I understand the special cases for hyphenation, but I don't think mine are special cases.
I was able to paste the conditional hyphen into the replace box of the autocorrect, but it failed to autocorrect even when I allowed that feature. It seems a very brutal method in any case. I'll stick with doing it manually. Thanks very much for going to so much trouble to explain it to me.
AOO 4.1.7 and LO 7.1, Windows 10
Post Reply