Sunday, March 9, 2014

The Dissociate Script and Batch

I'm using the ActiveState install of Perl64. After I completed the installation I installed the Dissociate module by using ppm [the perl package manager].

I created a Perl script to call the Dissociate module. I named the script diss.pl. It contains the following:

#!/usr/local/bin/perl
use Games::Dissociate; dissociate_filter; 
srand();

The srand() command was added after I found that it did not seem that the output of the filter was "random enough".

I call the script using a batch file. Here is an example of a character level filter with the n-gram set to 6

perl diss.pl -c6 -m10000 SumProvb-all.txt>SD6-c6.txt 

The file "SumProvb-All.txt" contains 1042 Sumerian proverbs. The stdio is piped to an out put file named "SD6-C6.txt". Here is a  small sample of the "raw" output of this batch file:
How can a poor man! The nine of you hurt?" The meaning, that city of the lame, the heavens. Let the water. Like a horse you paw the relevant information, it is an abomination to Succumb will be your exercise tablet!

Between our feet like sandals!" Before the heart does not know fear of god creates good fortune reinforce the winds. Wealth is exposed to me. In my heart that aches. May Lumma grant prosperity, the one there. The cow walks about, she loses something consumed by fire, those behind him don't say: "When will earn his packs, said: "The whole of the she-goat: "Let me pull at my husband's embrace. Sons-in-law -- what will listen to you! Youthful penis with interest payments so small?" He who can lifts his gaze to you Enlil look upon the city that he cursed." The prosopis plant is hired.

Don't give the slave girl. Her friend? She growls like your canal? like a runaway slave girl, I have no authority over my mistress It just one day but leaves my heart, which Me-silim had built by a treacherous. O lion, your allies in the rest. Slander occurs where there are carried. Your outhouse is the water?" "I sprinkle the ground. In the palace. Each fox is everywhere. You are pouring out, so that it does not become forth from it.

For a word level n-gram I use a batch file which contains something like:

perl diss.pl -w2 -m10000 SumProvb-all.txt>wsd3-w2.txt

The -w2 denotes a word level n-gram of 2. The resulting output looks like:

head succeeds in crossing the river. He who was seized by anger poured it out: "I am carrying my city to the fold, the lion cried: "I release you!" She said to his wife: "examined her: "At least I am all alone." The word of his father is an abomination to Ninurta. To serve beer with unwashed hands, to one's god. split it, And this after you split it? What kind of a wolf.

You should not alienate their rituals! Where there are no dogs, the fox could not overturn the anvil, so it overturned the water-provided for him.

A fool. Because I was flapping my arms like a bird. flying around is your share. Nine wolves having caught ten sheep, there was one too many and they did not fart in her husband's embrace. Sons-in-law -- what have they brought? Fathers-in-law -- rejoices over it: "It became cloudy, but it does not understand: "Put it down!" The donkey after he had thrown off his packs, said: "Now I can forget my burdens of former days!" The donkey, after he had thrown off his packs, said: "Now I can forget the burdens of former days!" The duck is the glory of the fields. is to forget. For him who dances, the sun shines. For the swaggerer; he is afflicted with diseases. Putting unwashed hands to spit without covering it with dust, and to seize should be abominations there. Enlil's temple is a cloth stretched out in the desert; A plant as sweet as a slave girl, Let her eat the flesh of a wolf. is eating. Utu looks down on it and didn't recognise what was in it. A cause for celebration. An unjust heir who does not support a wife, during a festival! Don't give Don't know you own name? Shame on you! You are an outstanding scribe; you are forever pushing, like a fearful slave girl. 

Now all you need do is cherry pick what looks like good one liners, verify that they are not in the source file. For those who like to play with this kind of stuff and have experience in Perl, Dissociate can also be called as a function



No comments:

Post a Comment