Flex and trigrams

Flex and trigrams

Post by Antoine Le » Thu, 24 Jan 2002 04:43:53



Hello all!

Here is a program i want ot code with Flex:
I have a text from which I want to extract trigrams.
For example: if I got the two words "Hello world", I would like Flex
to recognize the following sequences:
"Hel", "ell", "llo", "wor", "orl", "rld"

I know i have to use the `reject' clause but i can't get it to work

Maybe you can help me ?


 
 
 

Flex and trigrams

Post by Russe » Thu, 24 Jan 2002 08:19:36



+ Hello all!
+
+ Here is a program i want ot code with Flex:
+ I have a text from which I want to extract trigrams.
+ For example: if I got the two words "Hello world", I would like Flex
+ to recognize the following sequences:
+ "Hel", "ell", "llo", "wor", "orl", "rld"
+
+ I know i have to use the `reject' clause but i can't get it to work
+

Do you really need to use lex? This is reasonably simple in Perl;

while (<>) {
        chomp;


Quote:}

r.