OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Suggestions Wanted for formula based on letters not numbers

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
droog
Newbie
Newbie


Joined: 18 Aug 2007
Posts: 2

PostPosted: Sat Aug 18, 2007 5:53 pm    Post subject: Suggestions Wanted for formula based on letters not numbers Reply with quote

Hi All,

I need to set up a phonetic pronunciation formula for over 2000 phrases on how to pronounce a Spanish phrase correctly. Here's an example I have right now without the phonetic forumula-

I have a white house.
Tengo una casa blanca. (I have a white house)

Now I need to show how to pronounce that correctly. In this case that would be-

I have a white house.
Tengo una casa blanca.
Tehn-goh oo-nah kah-sah blahn-kah.

So I need some way to set up a formula for each letter in the alphabet. For the above phrase it would break down like this-
t=t
e=eh
n=n
g=g
o=oh
u=oo
a=ah
c=k
s=s
b=b
l=l

I will probably need some two letter combos also. For example, in Spanish, if an "e" follows a "g" the "g" changes it's pronunciation. So I would have to factor things like that in or correct them manually if two letter combo formulas aren't possible.

Right now all the phrases are on their own line . Like this-

English phrase.
Spanish phrase.

English phrase.
Spanish phrase.

English phrase.
Spanish phrase.

I would like to insert the phonetic pronunciation under the Spanish phrase (and hopefully keep the space between each phrase group) using some kind of batch method instead of pasting it in one at a time. But anything is better than doing each one by hand.

Any suggestions will be very much appreciated. Also if there isn't any easy way to do this using open office perhaps someone knows a web site where I could set up the formula then paste the results into open office wrtier.

THANKS!
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Sun Aug 19, 2007 1:43 am    Post subject: Reply with quote

I think you will have to Search and Replace to get the sentences in phonetic form unless you have a Spanish<>Spanish phonetic dictionary.

Unless you have more than 60000 of them I would convert your file to a csv and import it into Calc.

Using the text editor Bluefish, for example, on a text file which had one line English, one line Spanish, one line blank you could do:

Replace \n\n with \n#\n (assuming # is a character that does not appear in your texts)
Replace \n with \t
Replace \t#\t with \n

save it as filename.csv. Open it in Calc (tell it separated by tabs) and you should have one column with the English sentences next to a column with the Spanish sentences.

You could create your phonetic sentences in a plain text editor and convert that to a spreadsheet as for English and Spanish sentences. Then paste this single column next to the double column you have in your first spreadsheet. You should then have a spreadsheet with English sentences in column 1, Spanish sentences in column 2 and phonetic sentences in column 3 which you can convert to a text file if so required.
Back to top
View user's profile Send private message
floris_v
Moderator
Moderator


Joined: 12 Jul 2007
Posts: 4791
Location: Netherlands

PostPosted: Sun Aug 19, 2007 1:46 am    Post subject: Reply with quote

That's a nice job for a macro programmer. It can certainly be done, including the two letter combos, but I haven't done anything with the OOo macro language.

Here's an outline of how it should work for single sentences:
Select the sentence, assign the selection to a string variable, parse that string. Set up a null string for the phonetic text. First check if the next two letters are something you have a code for, if not take the code for the next single letter, add the code to the phonetic string. When you're through, insert the phonetic string on the next line.

If you collection of sentences is structured correctly you could even make a single loop that works its way through the entire list.
_________________
LibreOffice 3.6.3; OOo 3.4.1 on Windows Vista
Join the Official community forum - in several languages, including Nederlandstalig forum
Back to top
View user's profile Send private message
multi-lingual_ooo
OOo Advocate
OOo Advocate


Joined: 06 Nov 2004
Posts: 458

PostPosted: Mon Aug 20, 2007 5:05 pm    Post subject: Re: Suggestions Wanted for formula based on letters not numb Reply with quote

droog wrote:

I need to set up a phonetic pronunciation formula for over 2000 phrases on how to pronounce a Spanish phrase correctly. Here's an example I have right now without the phonetic forumula


For me, the quickest/fastest way to do that would be to
* Write a SED script to convert the Spanish words to the IPA glyphs;
* Save the file as plain text;
* Run the SED script;
* Copy/paste the original text in a column for Calc;
* Insert a "#" or other glyph that isn't used in either text in each row on a column after the Spanish text;
* Copy/paste the output from SED into a column on the Calc page;
* Copy paste the three (or more) Columns in the Calc page to Write;* Run a search/replace, replacing the "#" with a new line;
* Run a macro to delete the lines that contain English pronunciation;

It would be possible to write an OOo macro that does what you want. I don't know enough about macro writing to be able to do that. Sad
FWIW, such a macro would be useful, as it could serve as the basis for providing phonetic transcriptions for other languages, or transliterating between writing systems.

Now wondering if Ian, Andy, or one of the other macro writers could be talked into writing at least a working example.

xan

jonathon
_________________
One of the following might contain more details:

http://oooauthors.org/en/members/tutorials/multilingualooo/
http://esnips.com/web/OOoRelatedThings/
http://esnips.com/web/GraphologyTools
Back to top
View user's profile Send private message Send e-mail
droog
Newbie
Newbie


Joined: 18 Aug 2007
Posts: 2

PostPosted: Mon Aug 20, 2007 11:50 pm    Post subject: Reply with quote

I want to thank each of you for your suggestions so far. I will look into each of them. The only snag is I don't have tech/coding knowledge. Dreamweaver is about it. So any sophisticated solution would have to be weighed against the time I would need to get up to speed with it.

I will look into each of your suggestions and if anyone has any other ideas that are fairly simple and staightforward, they are appreciated.

Thanks again!
Back to top
View user's profile Send private message
multi-lingual_ooo
OOo Advocate
OOo Advocate


Joined: 06 Nov 2004
Posts: 458

PostPosted: Tue Aug 21, 2007 12:35 pm    Post subject: Reply with quote

droog wrote:
I don't have tech/coding knowledge.


I'll write the SED script for you, if you list the syllables, and how they are pronounced. (Put the list in this thread. Maybe somebody can convert it to a macro that you can use.)

xan

jonathon
_________________
One of the following might contain more details:

http://oooauthors.org/en/members/tutorials/multilingualooo/
http://esnips.com/web/OOoRelatedThings/
http://esnips.com/web/GraphologyTools
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group