LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sentence separation into text lines

Hi all!
Does anyone know if there is a sentense separation tool for labview?
It should be able to work much like this:
1) reads a text file (foo1.txt)
2) checks weather a capital letter is located after a delimiter (dot,
new line, tab)
3) reads a string till next dot
4) checks weather the next dot is followed by a capital letter
5) if it is --> 7)
6) if not --> reads a sentence-string till next dot is is followed by a
capital letter -->7
7) extracts all complete sentence-strings into their own lines in an
another text file (foo2.txt )


If that aid-tool is somewhere in the internet, it seems to be well
hidden 🙂

Regards: Timo Ruonala
0 Kudos
Message 1 of 5
(3,294 Views)
Timo,

You have outlined the VI you need to write ! It's a breeze. Start with a for
loop that loops till the end of the file (foo1.txt) (length of string result of
read characters from file - all characters). Then in the loop - output the
characters one at a time to the 2nd file (foo2.txt) until you come across the
condition you mentioned (a period followed by a capital) I would make a boolean
passed through a shift register so that if a period was found I would process
another about 3 characters before deciding that it was some other use of the
dot. If I found a capital letter I would set the boolean false again, then
output a CR/LF character then the capital that triggered the next line. In the
end you have a new text file will all the sentence one on line. F
ast too!

Henry
0 Kudos
Message 2 of 5
(3,294 Views)
Timo,

I wipped together a VI that will do this for you. Tell me if it what you
where looking for.

Henry
0 Kudos
Message 3 of 5
(3,294 Views)
Thank you Henry!

That is the one and a beautiful one too. I am a very beginner to labview and had just about
made the NI examples before this. So the reason to I did not make it myself was simply cause
I could not get the loop working (tried for days). Once again THANK YOU sir for helping
in this, I will study the VI carefully. (it's a bit more advanced than my match-pattern chain 🙂

Best regards: Timo


Henry Coulter wrote:

> Timo,
>
> I wipped together a VI that will do this for you. Tell me if it what you
> where looking for.
>
> Henry
>
> ------------------------------------------------------------------------
>
0 Kudos
Message 4 of 5
(3,294 Views)
You've done the pseudocode plan, so go the whole hog and write the thing!

Use the "match pattern" function to find a full stop, then from there scan
the string character by character till you find a non-whitespace char, then
see if it's a capital- both using the "lexical class" function. Then find
the next full stop, and your sentence is the text between the first
character found (not the first full stop) and the last char before the full
stop. I'd be inclined to bung that into an array of sentences for easy
playing with further down the line. Bung the thing in a while loop, with a
shift register to hold a character pointer for the "match pattern" function,
and set the conditional to true if the output pointer from the match pattern
is greater or equal to zero. You
'll need a little extra thought to deal with
the first and last sentence.

Trivial, and less time consuming than messing about with web searches and
Usenet.


Timo Ruonala wrote in message
news:392FD689.6CFEE42D@netscape.net...
> Hi all!
> Does anyone know if there is a sentense separation tool for labview?
> It should be able to work much like this:
> 1) reads a text file (foo1.txt)
> 2) checks weather a capital letter is located after a delimiter (dot,
> new line, tab)
> 3) reads a string till next dot
> 4) checks weather the next dot is followed by a capital letter
> 5) if it is --> 7)
> 6) if not --> reads a sentence-string till next dot is is followed by a
> capital letter -->7
> 7) extracts all complete sentence-strings into their own lines in an
> another text file (foo2.txt )
>
>
> If that aid-tool is somewhere in the internet, it seems to be well
> hidden 🙂
>
> Regards: Timo Ruonala
>
>
>
0 Kudos
Message 5 of 5
(3,294 Views)