Task ideas for Google Code-in/Print transducer with n cycles

From Apertium
< Task ideas for Google Code-in
Revision as of 13:48, 7 January 2017 by Francis Tyers (talk | contribs) (Created page with "<pre> <spectre> imagine you have a dictionary like this: <spectre> <dictionary> <spectre> <alphabet>ab</alphabet> <spectre> <sdefs/> <spectre> <section id="main" type="...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<spectre> imagine you have a dictionary like this:
<spectre> <dictionary>
<spectre>   <alphabet>ab</alphabet>
<spectre>   <sdefs/>
<spectre>   <section id="main" type="standard">
<spectre>     <e><re>ab+</re></e>
<spectre>   </section>
<spectre> </dictionary>
<spectre>  
<spectre> $ lt-comp lr /tmp/foo.dix  /tmp/foo.bin
<spectre> main@standard 3 3
<spectre> $ lt-print /tmp/foo.bin 
<spectre> 0 1 a a 
<spectre> 1 2 b b 
<spectre> 2 2 b b 
<spectre> 2
<spectre>  
<spectre> you can see '2 2 b b ' is a cycle
<spectre> it allows a and any number of b
<spectre> $ echo "abb" | lt-proc /tmp/foo.bin 
<spectre> ^abb/abb$
<spectre> $ echo "abbb" | lt-proc /tmp/foo.bin 
<spectre> ^abbb/abbb$
<spectre> but not:
<spectre> $ echo "abbba" | lt-proc /tmp/foo.bin 
<spectre> ^abbba/*abbba$
<spectre>  
<spectre> so, the idea is to print out all the strings accepted by the transducer
<spectre> but only following cycles n times
<spectre> so given this transducer
<spectre>
<spectre> lt-print -n 2 /tmp/foo.bin
<spectre> would give:
<spectre>  
<spectre> ab:ab
<spectre> abb:abb
<spectre>  
<spectre> and
<spectre> lt-print -n 3 /tmp/foo.bin
<spectre> would give:
<spectre>  
<spectre> ab:ab
<spectre> abb:abb
<spectre> abbb:abbb
<spectre>  
<spectre> got it ?