Jump to content

Help_base worrd-rhyme-syllable


Recommended Posts

Help, I'm new here and trying to learn something programirarti in AutoIt.

the real reason for this problem plaguing me:

Search the database of words last 3-4 letters, or (1-2 record) in relation to rhyme in poetry.

I'm from the Croatian and please forgive me not knowing the English language. Thanks!

.........................

Baza_1.txt (word)

Slavko (Slav-ko)

pjesnik (pjes-nik)

bicikli (bi-ci-kli)

jako (ja-ko)

duboko (du-bo-ko)

zaljubljenik (za-lju-blje-nik)

rimarij (ri-ma-rij)

..........................

Baza_2.txt (rhyme-syllable)

ko

nik

kli

..........................

Baza_3.txt (admission discovered)

-ko

Slavko

jako

duboko

-nik

pjesnik

zaljubljenik

-kli

bicikli

...........................

Edited by Slavko
Link to comment
Share on other sites

Thank you called to help me, but I think you understood the problem, the baza_2 should take the first syllable and find all the words in baza_1 ending a syllable, and those that result in write baza_3, all repeat with the remaining records in baza_2.

Baza_3 a printed search result ...

Thanks again!

Edited by Slavko
Link to comment
Share on other sites

the baza_2 should take the first syllable and find all the words in baza_1 ending a syllable, and those that result in write baza_3, all repeat with the remaining records in baza_2.

Baza_3 a printed search result ...

If I've understood you correctly this should work:

#include <file.au3>

$baza1=@ScriptDir & "\Baza_1.txt"
$baza2=@ScriptDir & "\Baza_2.txt"
$baza3=@ScriptDir & "\Baza_3.txt"
Global $aBaza1,$aBaza2
_FileReadToArray($baza1,$aBaza1)
_FileReadToArray($baza2,$aBaza2)

$hbaza3=FileOpen($baza3,2)
For $i=1 to $aBaza2[0]
    FileWrite($hbaza3,"-" & $aBaza2[$i] & @CRLF & @CRLF)
    For $j=1 to $aBaza1[0]
    $checking=StringRegExpReplace($aBaza1[$j],"(.*" & $aBaza2[$i] & ")\s\(.*-" & $aBaza2[$i] & "\).*","$1")
        If @extended > 0 Then
            FileWrite($hbaza3,$checking & @CRLF)
        EndIf
    Next
    If $i < $aBaza2[0] Then FileWrite($hbaza3,@CRLF & @CRLF)
Next
FileClose($hbaza3)

Edit: I've changed regexp to be more accurate.

Edited by sahsanu
Link to comment
Share on other sites

An example of what I imagine you want.

#include <File.au3>
#include <Array.au3>

; ------------- Create "Bazza_1.txt" --------------------------
Local $sWords = "Slavko     (Slav-ko)" & @CRLF & _
        "pjesnik    (pjes-nik)" & @CRLF & _
        "bicikli    (bi-ci-kli)" & @CRLF & _
        "jako       (ja-ko)" & @CRLF & _
        "duboko     (du-bo-ko)" & @CRLF & _
        "zaljubljenik (za-lju-blje-nik)" & @CRLF & _
        "rimarij    (ri-ma-rij)"

If FileExists("Bazza_1.txt") Then FileDelete("Bazza_1.txt")
FileWrite("Bazza_1.txt", $sWords & @CRLF)

;  ------------ Create "Bazza_2.txt" --------------------------
Local $sWords = FileRead("Bazza_1.txt")
Local $aTemp = StringRegExp($sWords, "(?m)(?:^\H+)\h+(?:\H+)-(\H+)\)", 3)
Local $aRhymn = _ArrayUnique($aTemp)
_FileWriteFromArray("Bazza_2.txt", $aRhymn, 1)

;  -------------Create "Bazza_3.txt" --------------------------
Local $sResult
For $i = 1 To UBound($aRhymn) - 1
    Local $aMatch = StringRegExp($sWords, "(?m)(^\H+)\h+(?:\H+-" & $aRhymn[$i] & ".)", 3)
    $sResult &= "-" & $aRhymn[$i] & @CRLF & @CRLF
    For $j = 0 To UBound($aMatch) - 1
        $sResult &= $aMatch[$j] & @CRLF
    Next
    $sResult &= @CRLF
Next
If FileExists("Bazza_3.txt") Then FileDelete("Bazza_3.txt")
FileWrite("Bazza_3.txt", $sResult)

;  ----------------- Display and clean up. ------------------
Local $sDisplay
For $x = 1 To 3
    $sDisplay &= "................................." & @CRLF & @CRLF
    $sDisplay &= "Bazza_" & $x & ".txt" & @CRLF & @CRLF
    $sDisplay &= FileRead("Bazza_" & $x & ".txt") & @CRLF & @CRLF
    ShellExecute("Bazza_" & $x & ".txt")
Next
$sDisplay &= "................................." & @CRLF
ConsoleWrite($sDisplay & @CRLF)

Local $iReply = MsgBox(4, "Results", $sDisplay & @CRLF & @CRLF & 'To delete "Bazza_1.txt", ' & _
        '"Bazza_2.txt", "Bazza_3.txt"' & @CRLF & ' press "Yes" button.')
If $iReply = 6 Then
    FileDelete("Bazza_1.txt")
    FileDelete("Bazza_2.txt")
    FileDelete("Bazza_3.txt")
EndIf
Link to comment
Share on other sites

@ sahsanu .... well you understand, but the problem has not printed words from Baze_1, Baze_2 print layout is ok, but between the print is just an empty field without the words he should find and print ....

-ko

... (here is written the word "Slavko"

-nik

....

clin-

....

..............................

I know you struggling with your ignorance, but I am very grateful for the assistance that we give thanks ...

@ Malkey ... Thank you and you've done a great second part of the job, and the result is excellent, but did not take into account that Baza_1 and Baza_2 must file to be read. I have a database in which the Croatian word to find records and to print Baza_2 ... of course I will write the necessary records that interest me.

Thanks to the effort to Display ... I think that it is not necessary because the choice of words there will be many words, so chosen that the display will be functional ...

Thank you both for the solution of the problem is in sight ... Slavko

Link to comment
Share on other sites

@ sahsanu .... well you understand, but the problem has not printed words from Baze_1, Baze_2 print layout is ok, but between the print is just an empty field without the words he should find and print ....

-ko

... (here is written the word "Slavko"

I've used your example Baza_1,txt and yes, it writes the words so I think you should post the right Baza_1.txt. Anyway, my script only will work if syllabe is in the format "-syllabe" will not work with "syllabe-" nor "-syllabe".

Now you must struggle with your ignorance and write some lines of code.

Link to comment
Share on other sites

Please help, I made a compilation of the above scripts visible, but now I have a problem that does not know to solve ...

This command does not know how to write.

Local $aTemp = StringRegExp($sWords, "(?m)(?:^\H+)\h+(?:\H+)-(\H+)\)", 3)

Baza_1 is written like this:

Slavko (Slav-ko)

pjesnik (pjes-nik)

bicikli (bi-ci-kli)

and properly be written as follows:

Slavko

pjsnik

bicikli

but if it is correct then we write the script does not work ....

Thanks!

kompilacija.txt

Link to comment
Share on other sites

What you could do is write what you want in your mother tongue below English. That how someone who knows your language can understand what you really want to do.

forgive me ... the Google translation, I'm afraid if I write in Croatian to me then you will not understand ...

I have two databases:

Baza_1 ... the Croatian word (not of changes in the)

Baza_2 ... endings rhyme, the last 3 or 4 letters (not changing)

Baza_1

abecedama

abecedarij

abecedirati

abecedni

abecednih

abecednim

abecedno

abecednoj

dama

sama

rimarij

.............

Baza_2

dama

rij

rati

dni

................

at third base should print this schedule!

Baza_3 (search results)

-dama

abecedama

dama

sama

-rij

abecedarij

rimarij

-rati

abecedirati

-dni

abecedni

....................

Link to comment
Share on other sites

Try me.

Trebam skriptu koja će mi iz rječnika napraviti popis rima, pjesnik sam i pišem sonete, tražio sam po internetu neki program koji bi mogao pretraživati bazu riječi no nisam našao ništa zgodno....ima jedan dobar program "Verse Perfect" koji je napravljen baš za pjesnike...no ja bi bio jako zadovoljan kada bi za početak imao jednu malu skriptu koja bi mi zadovoljila gore navedene kriterije....

AutoIt mi je zgodan program radio sam prije neke male skripte no nemam one programerske osnove pa pi je teško savladati ovakvu skriptu...

Bio bih ti zahvalan kada bi mi pomogao u riješavanju problema....Hvala na razumjevanju, Slavko.

jojjjj...pa sad vidim da si iz Splita...bravo!!!

Edited by Slavko
Link to comment
Share on other sites

I said below English. This is English speaking forum.

It's like whispering in front of other people. That's not polite.

So, basically you have a text files with random words (Baza_1.txt). You would like to be able to extract all of the rhyming words?

What's the purpose of Baza_2.txt and Baza_3.txt? What you need is graphic interface and algo to work with Baza_1.txt. Right?

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Baza_2. txt extensions are well-known rhymes and abecebnim arranged in a row, that I made ​​in Excel ... meaning in that file I have written:

Baza_2.txt

ko

bav

nije

ije

je

..... to the last 3-4 letters of the word.

If you have no Baza_2 randomized rhymes, but in cases of known base can define in advance the schedule found.

Baza_3.txt .... the search result and should be written like this:

-ko

Slavko

-nije

smije

nije

milije

.....................

If you have the ability and willingness to help me I would be grateful, graphical interface would be ok but I still have some details that I would like to enter later ... so now it's not so important how it looks ... Thank you for your patience ... Slavko

Link to comment
Share on other sites

I've written this code following the examples you posted

#include <file.au3>

$baza1=@ScriptDir & "\Baza_1.txt"
$baza2=@ScriptDir & "\Baza_2.txt"
$baza3=@ScriptDir & "\Baza_3.txt"
Global $aBaza1,$aBaza2
_FileReadToArray($baza1,$aBaza1)
_FileReadToArray($baza2,$aBaza2)

$hbaza3=FileOpen($baza3,2)
For $i=1 to $aBaza2[0]
    FileWrite($hbaza3,"-" & $aBaza2[$i] & @CRLF & @CRLF)
    If StringLen($aBaza2[$i])=4 Then $aBaza2[$i] = StringTrimLeft($aBaza2[$i],1)
    For $j=1 to $aBaza1[0]
        $checking=StringRegExp($aBaza1[$j],".*" & $aBaza2[$i] & "\z",0)
        If $checking=1 Then
            FileWrite($hbaza3,$aBaza1[$j] & @CRLF)
        EndIf
    Next
    If $i < $aBaza2[0] Then FileWrite($hbaza3,@CRLF & @CRLF)
Next
FileClose($hbaza3)

But, now I can see this post:

Baza_2. txt extensions are well-known rhymes and abecebnim arranged in a row, that I made ​​in Excel ... meaning in that file I have written:

Baza_2.txt

ko

bav

nije

ije

je

..... to the last 3-4 letters of the word.

I'm so sorry but don't understand it. You said that the rhyme should fit last 3-4 letters of the word but you have several 2 letter syllabes...

Baza_3.txt .... the search result and should be written like this:

-ko

Slavko

-nije

smije

nije

milije

...so I'm wondering what do you expect for -nije -ije -je (or similar situations)?. Following your examples -nije and -ije should fit the same words but ... what happens to -je?

An example (disclaimer: there are several invented words):

Baza_1.txt

slavko
smije
nije
milije
milaje
abecedama
sama
jelijma

Baza_2.txt

ko
mije
ije
je
dama
ma

Could you please post what you expect for Baza_3.txt?. Believe me, I want to help you but it is hard to understand what do you need if you don't post complete examples. :huh2:

Link to comment
Share on other sites

I've written this code following the examples you posted

#include <file.au3>

$baza1=@ScriptDir & "\Baza_1.txt"
$baza2=@ScriptDir & "\Baza_2.txt"
$baza3=@ScriptDir & "\Baza_3.txt"
Global $aBaza1,$aBaza2
_FileReadToArray($baza1,$aBaza1)
_FileReadToArray($baza2,$aBaza2)

$hbaza3=FileOpen($baza3,2)
For $i=1 to $aBaza2[0]
    FileWrite($hbaza3,"-" & $aBaza2[$i] & @CRLF & @CRLF)
    If StringLen($aBaza2[$i])=4 Then $aBaza2[$i] = StringTrimLeft($aBaza2[$i],1)
    For $j=1 to $aBaza1[0]
        $checking=StringRegExp($aBaza1[$j],".*" & $aBaza2[$i] & "\z",0)
        If $checking=1 Then
            FileWrite($hbaza3,$aBaza1[$j] & @CRLF)
        EndIf
    Next
    If $i < $aBaza2[0] Then FileWrite($hbaza3,@CRLF & @CRLF)
Next
FileClose($hbaza3)

But, now I can see this post:

I'm so sorry but don't understand it. You said that the rhyme should fit last 3-4 letters of the word but you have several 2 letter syllabes...

...so I'm wondering what do you expect for -nije -ije -je (or similar situations)?. Following your examples -nije and -ije should fit the same words but ... what happens to -je?

An example (disclaimer: there are several invented words):

Baza_1.txt

slavko
smije
nije
milije
milaje
abecedama
sama
jelijma

Baza_2.txt

ko
mije
ije
je
dama
ma

Could you please post what you expect for Baza_3.txt?. Believe me, I want to help you but it is hard to understand what do you need if you don't post complete examples. :huh2:

;):alien::ph34r:

@ shashanu .... thank you script works great!

contacting with the results because the search will take a while for a largeamounts of of words .... once again thank you ,Thank you !

Edited by Slavko
Link to comment
Share on other sites

The truth, well you noticed that some rime overlap

as "-ije" and "-je"will be much the same words in both categories ...

Bazu_2 could be a little dress that no such overlap, but now it's not a problem.

The task that I wanted to do in this post is filled Thank You!

Edited by Slavko
Link to comment
Share on other sites

The truth, well you noticed that some rime overlap

as "-ije" and "-je"will be much the same words in both categories ...

Bazu_2 could be a little dress that no such overlap, but now it's not a problem.

The task that I wanted to do in this post is filled Thank You!

Yeah, those rhymes are a problem :huh2:. Anyway, I'm really happy you get what you needed... you are welcome.

Link to comment
Share on other sites

In Excel, I filtered out the last 4 letters of the word, that He shared a table in this schedule: xaxx, xexx, xixx, xoxx, xuxx, xxxx, xxx.

Total of 9939 different rhymes.

I often use a filter in Excel when looking for a new and good rhymes for songs, here's one of many sonnets that I wrote.I hope the translation is at least a little good ...

Do you know ...

Whenever I have a friend wrote,

Always send a sincere response

and this time we wish fulfilled

that `living not by land, exhausted by grief.

Jel know, say, the deepest secrets of desire,

midst of a heart who carries the symbol

so, do I, which borne sings love

So I'm burning bright at its every mention.

When you be conveniently write me a verse,

because I need the comfort of a true connoisseur;

how to keep the arrow odapetih.

Until then we will be craving `, sorrow of heart;

her hips never of reached

and fantasies that first kiss.

.... You leave with a smile ... Slavko

the Croatian language ...

Znaš li…

Kad god sam ti pisao prijate-lju,

odgovor uvijek pošalješ is-kren

i ovaj puta ispuni mi že-lju

da živeć` ne kopnim, tugom izmo-ren.

Jel znaš, reci; žudnje tajnu najdub-lju,

posred srca tko li nosi taj zna-men

taj, jel sam, što pjeva nošen ljubav-lju

pa žarko gorim na svaki njen spo-men.

Kad zgodno ti bude napiši mi s-tih,

jer utjehu trebam od pravog znal-ca;

kako se čuvat strelica odape-tih.

Do tad će mi žudnja bit` , tuga sr-ca;

njenih bokova nikad dosegnu-tih

i maštanje onog prvog poljup-ca.

Link to comment
Share on other sites

;--------------------------------------------------------------------------------;
;           script created by "sahsanu" forum member                             ;
;AutoIt Forums:                                                                  ;
;http://www.autoitscript.com/forum/topic/129013-help-base-worrd-rhyme-syllable/  ;
;                                                                                ;
;Croatian dictionary rhymes - (Slavko Kukec-PiPi - poet)                         ;
;                                                                                ;
;--------------------------------------------------------------------------------;

#include <file.au3>

MsgBox(64, "Croatian dictionary rhymes","script created by *sahsanu* forum member" & @CRLF & "http://www.autoitscript.com/forum" & @CRLF & @CRLF & "             conception by" & @CRLF & "     Slavko Kukec-PiPi - poet")
MsgBox(0, "Important", "constant" & @CRLF & "Baza_1.txt - dictionaries              windows" & @CRLF & "Baza_2.txt - syllables (*xxxx)          dows"& @CRLF & @CRLF & "program creates Baza_3.txt - in which the results of searching.")

$baza1=@ScriptDir & "\Baza_1.txt"
$baza2=@ScriptDir & "\Baza_2.txt"
$baza3=@ScriptDir & "\Baza_3.txt"
Global $aBaza1,$aBaza2
_FileReadToArray($baza1,$aBaza1)
_FileReadToArray($baza2,$aBaza2)

$hbaza3=FileOpen($baza3,2)
For $i=1 to $aBaza2[0]
    FileWrite($hbaza3,"-" & $aBaza2[$i] & @CRLF & @CRLF)
    If StringLen($aBaza2[$i])=5 Then $aBaza2[$i] = StringTrimLeft($aBaza2[$i],1)
    For $j=1 to $aBaza1[0]
        $checking=StringRegExp($aBaza1[$j],".*" & $aBaza2[$i] & "\z",0)
        If $checking=1 Then
            FileWrite($hbaza3,$aBaza1[$j] & @CRLF)          
        EndIf
    Next
    If $i < $aBaza2[0] Then FileWrite($hbaza3,@CRLF & @CRLF)
Next
FileClose($hbaza3)

This script is OK!

Postscript: I would like to solve another problem that I have, similar in nature and this script but a little complicated ...

It is about creating a database of various verses of the poet, and her search for rhymes of this principle has already made ​​scripts.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...