Did you know ... Search Documentation:
Pack ape -- prolog/parser/tokens_to_sentences.pl
PublicShow source

Converts a flat list of tokens into a list of sentences, each of which is a list of tokens. Sentences end with one of the three symbols: '.', '?', and '!'.

For example, the following list of tokens:

[John, likes, Mary, ., Every, man, owns, a, car, .]

is converted into the following list of sentences

[[John, likes, Mary, .], [Every, man, owns, a, car, .]]
author
- Kaarel Kaljurand
- Tobias Kuhn
version
- 2009-05-21
bug
- should we generate error messages here (if token list does not end with ./?/!)
 tokens_to_sentences(+Tokens:list, -Sentences:list) is semidet
Succeeds if Tokens is a list of ACE sentences, in this case the sentences are returned. To succeed the token list must either be empty or end with a sentence end symbol. E.g. the following token list would cause a failure:
[a, b, c]
Arguments:
Tokens- is a list of ACE tokens
Sentences- is a list of sentences (where a sentence is a list of ACE tokens)
 tokens_to_paragraphs(+Tokens, -Paragraphs)