Sorry for the '.*' I put it in hoping that the whole line would be matched and not truncated.
As far as the @current_sentence, I am just pushing words onto the array as I strip them from a data base. In the example I gave 'so' is the first word in the sentence, so I also added a '<s>' to the word I pushed, here is the code:
push @current_sentence, "<s> $current_word ";
Then I push additional words onto the array as I find them with this:
push @current_sentence, "$current_word ";
Finally the last word of a sentence gets pushed like so:
push @current_sentence, "$current_word <\/s>\n";
Another interesting comment, I just tried printing the string outside the if statement and the whole thing printed! But earlier I tried to get around this by having the if statement set a flag and then printing from another if statement that checked the flag... and it still printed truncated. So I still can't print conditionally.
Thanks for all the help so far.
An update: I have looked at the behavior on some other examples and it seem as though the print statement is printing the array element that was originally pushed onto the array, even though I put the array into a single string. What I mean be this is that if the word starts a sentence, the <s> tag is ahead of it, if it is in the middle there are no other tags, and if it was at the end a </s> tag follows it. Baffeling to me! |