Creating a dictionary with domain name adjuncted

Help with writing and playing macros

Creating a dictionary with domain name adjuncted

Postby dictdoc » Sat May 04, 2013 5:01 am

Hello,
I have created a dictionary which has the following structure:

Code: Select all
DOMAINWORD=(equivalent in English)gloss(es) in Hindi each separated by a comma(equivalent in English)gloss(es) in Hindi each separated by a comma or a semi-colon


An example will make this clear
Code: Select all
blatant=(noisy)ऊधमी,मुखर;(palpable)खुला,साफ़,स्पष्ट;(gaudy)भड़कीला;(flagrant)घोर
blazonry=भड़कीला प्रदर्शन
fancy{adj.}=विलक्षण,विचित्र,सनकी;(extravagant)मनमाना,अत्याधिक;(ornamental)रंग-बिरंगा,फैंसी,भड़कीला;(costly)महँगा;(special)विशिष्ट
fine{adj.}=(excellent)उत्तम,उत्कृष्ट,बढ़िया,अच्छा;(pure)विशुध्द,विमल,खरा,परिष्कृत;(weather)सुहावना;(not coarse)महीन,बारीक,सूक्ष्म;(thin)पतला,(delicate)कोमल,सुकुमार,मृदु; (sublte)सूक्ष्म;(sharp)तीक्ष्ण,नुकीला,(handsome)मनोहर,सुन्दर,सुहावना,चारु;(showy)भड़कीला,भड़कदार;(ornate)अलंकृत
flamboyant{adj.}=भड़कीला,भड़कदार; (style)अलंकृत
flaming=(burning)प्रज्वलित;(glowing)प्रदीप्त;(fig.,ardent)उत्कट,भावपूर्ण,जोशीला (of person);(showy)भड़कीला, (starting)विस्मयकारी
flashy=चमकीला,(showy)भड़कीला
flash{adj.}=भड़कीला,दिखावटी,नक़ली
florid=(rosy)गुलाबी,लाल,रक्ताभ;(gaudy)भड़कीला;(omate)अलंकृत,आलंकारिक
fussy=बतंगड़िया;(of dress)ठाठदार,भड़कीला
gallant{adj.}=बहादुर,वीर,(stately)प्रतापी,भव्य,(showy)भड़कीला,(amorous)श्रृंगारिक, (attentive to ladies)नारीसेवापरायण,रमणीरंजक,नारीभक्त
garish=भड़कीला;(of colours)चटकीला
gaudy=भड़कीला
gay=(merry) प्रसन्नचित,प्रफुल्ल, (light hearted) ज़िन्दादिल,विनोदी, (wanton) लम्पट,विषयी,विलासी, (brilliant)भड़कीला,चमकीला
glare{v.}=चमचमना,(be too showy)भड़कीला या चटकीला होना,(stare)तरेरना
glaring=(shining)चमकीला,चटकीला, (showy)भड़कीला, (fierce)क्रोधपूर्ण,सुस्पष्ट
glary=(shining) चमकीला,चटकीला,(showy)भड़कीला,(fierce)क्रोधपूर्ण,सुस्पष्ट
gorgeous=शानदार,भड़कीला,(of style)अलंकृत,आलंकारिक
grand=(chief)प्रधान,उच्च,मुख्य,(impose)भव्य,विशाल,शानदार,प्रतापी,वैभवशाली, (great) महान्,महा-,(important)महत्वपूर्ण;(haught)गर्वित,गर्वयुक्त,अभिमानी,(showy)भड़कीला,(llustrious) प्रसिद्ध,प्रतिष्ठीत
meretricious=वेश्या का,वेश्या-सुलभ;(showy)नकली,भड़कीला,भडकदार
ostentatious=(of a person)आडम्बरप्रिय,आडम्बरि;दिखावटी,भड़कीला,आडम्बरपूर्ण,आडम्बरी
rich=धनी,धनवान,धनाढय,मालदार,दौलतमन्द;(abundant)प्रचुर,विपुल;(abounding in)से भरपूर, समृध्द;(valuable)मूल्यवान्;(fertile)उपजाऊ,उर्वर;(splendid)भड़कीला,शानदार;(of food)बढ़िया,स्वादिष्ठ,मसालेदार (spicy);(of colours)चटकीला;(of voice)गंभीर;(amusing)मनोरंजक;(of mixture)गाढ़ा
showy=(ostentatious)आडम्बरी;(gaudy)भड़कीला,दिखावटी,दिखाऊ;(striking)असाधारण,विशिष्ट,दर्शनीय
shy{adj.}=(bashful)संकोची,शर्मीला,झेंपू,लज्जालु,(easily startled)भड़कैल,भड़कीला,(wary) चौकन्ना,सतर्क,चौकस,सचेत,(elusive)दुष्प्राप्य,दुर्बोध
spectacular=(impressive)प्रभावशाली,भव्य,शानदार;(amazing)अपूर्व,चमम्कारीक,आश्र्चर्य-जनक; (showy)आडम्बरपूर्ण,भड़कीला,दिखाऊ,आडम्बरप्रिय,आडम्बरी (of person)
splendid=(magnificent)भव्य,शानदार,वैभवशाली;(brilliant,shining)चमकीला,भड़कीला (grand,glorious)गौरवपूर्ण,प्रतापमय,प्रतापी,महान्,ख्यातिकर;(excellent)अत्युत्तम,बढ़िया,उत्कृष्ट,अच्छा
staring=भड़कीला,भड़कदार
tatty{adj.}=(ragged)फटा-पुराना;(fussily ornate)भड़कीला;(of person)फटीचर
tawdry{adj.}=भड़कीला,दिखाऊ;भद्दा,बेढंगा
tinsel{adj.}=भड़कीला,नुमाइशी,लिफ़ाफ़िया
tinsel{v.}=पन्नी लगाना;भड़कीला बना देना
trumpery{adj.}=भड़कीला,दिखाऊ,रद्दी,निस्सार


What I need is a script which will do the following:

Code: Select all
domain=(english equivalent) gloss(es) in Hindi

An example will make this clear. Input of first two entries

Code: Select all
blatant=(noisy)ऊधमी,मुखर;(paIpable)खुला,साफ़,स्पष्ट;(gaudy)भड़कीला;(flagrant)घोर
blazonry=भड़कीला प्रदर्शन

EXPECTED OUTPUT OF THE FIRST TWO ENTRIES. In case 2 there is no bracket so the domain word stands by itself. In case a part of speech is appended to the domain indicated by curly brackets, it should be treated as part of the domain.

Code: Select all
blatant=(noisy)ऊधमी,मुखर
blatant=(palpable)खुला,साफ़,स्पष्ट
blatant=(gaudy)भड़कीला
blatant=(flagrant)घोर
blazonry=भड़कीला प्रदर्शन

At present I am using a macro which identifies the first equal to, stores it in memory, identifies the the first left bracket, places the domain word followed by equal to before the bracket, stores the full string on another line and continues the operation till all original instances of left bracket on a given line are exhausted.
The macro works but is horribly slow. Any way of speeding it up, please.
Even a perl script would do.
Many thanks. The file is huge and contains 60,000 domain headwords.
dictdoc
Basic User
Basic User
 
Posts: 19
Joined: Tue Jan 19, 2010 1:56 am

Re: Creating a dictionary with domain name adjuncted

Postby Mofi » Sat May 04, 2013 9:11 am

What about this simple macro running an UltraEdit tagged regular expression Replace All in a loop until there is no line found anymore with an opening parenthesis after the equal sign and a semi-colon and some more characters?

InsertMode
ColumnModeOff
HexOff
Top
UltraEditReOn
Loop 0
Find MatchCase RegExp "
%^(*=^)^((*^);^(?+^)$"
Replace All "
^1^2^p^1^3"
IfNotFound
ExitLoop
EndIf
EndLoop
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Creating a dictionary with domain name adjuncted

Postby dictdoc » Sat May 04, 2013 8:29 pm

Dear Mofi,
Many thanks. I copied the macro that you had created and tried to run it. I got an error message that UltraEditReOn was not valid.
I have an UltraEdit 14.01a created 2008. Is it because of that.
When I disabled UltraEditReOn and tried the macro it did create the dictionary but only partly.
Any help to solve this would be just great.
dictdoc
Basic User
Basic User
 
Posts: 19
Joined: Tue Jan 19, 2010 1:56 am

Re: Creating a dictionary with domain name adjuncted

Postby Mofi » Sun May 05, 2013 9:27 am

In your older version of UltraEdit the name of the command to select the UltraEdit regular expression engine is UnixReOff.

And in your version of UltraEdit the value 0 is not needed for a loop with no fixed value of loop runs. Therefore remove 0 from command Loop.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Creating a dictionary with domain name adjuncted

Postby dictdoc » Mon May 06, 2013 8:19 pm

Dear Mofi,
I followed your instructions to the letter and used UnixReOn. But the macro did not work. On checking the macro, I found that a space is inserted after the loop command. Even after removing it , when I reload the macro it is still there.Is this OK?
I simplified my database also and removed all the parts of speech tags which were between curly brackets and also did away with the commas. However the macro would not work.
I am really perplexed why it does not work.
Many thanks for all your help and sorry for the delay in replying.
dictdoc
Basic User
Basic User
 
Posts: 19
Joined: Tue Jan 19, 2010 1:56 am

Re: Creating a dictionary with domain name adjuncted

Postby Mofi » Tue May 07, 2013 7:14 am

Well, I wrote UnixReOff - turn off Unix and Perl regular expression engine which means use UltraEdit regular expression engine - and you added UnixReOn - turn on Unix regular expression engine.

The search and replace strings are in syntax for the UltraEdit regular expression engine and not for the Unix regular expression engine and therefore with UnixReOn the macro does surely nothing on the file.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Creating a dictionary with domain name adjuncted

Postby dictdoc » Tue May 07, 2013 11:35 am

I am so sorry. I suppose this is a reflex. I always set regular expressions on. My goof up.
I tested the macro, it works fine. Many thanks.
Sorry for the stupid error.
dictdoc
Basic User
Basic User
 
Posts: 19
Joined: Tue Jan 19, 2010 1:56 am


Return to Macros