6

I would be interested in calculating Flesch–Kincaid readability tests in latex documents and, besides the number of words, those tests require the number of sentences and syllables in the text. Texcount is a powerful tool, but counting sentences and syllables is not documented to be possible.

1
  • 1
    Welcome! I assume you meant 'syllables'. If not, please roll back my edit and explain the term 'syllabe'. While I can imagine you might be able to do something like this for sentences, I cannot imagine it being done for syllables because that would require accounting fora great deal of language-specific information in order to estimate syllables based on patterns, letter groups etc. And it would probably need lists of exceptions, too, for each language it knew about. I don't know what might be designed to do that but I'm sure texcount isn't. (Hyphenation patterns provide clues, but no more.)
    – cfr
    Jan 19 '16 at 1:50
2

This is too long to fit in a comment, so I write it as an answer.

Neither functionalities are supported by TeXcount.

TeXcount can identify and count the words. It can, however, produce a list of how many times each word occurs which could be helpful as a first step. You would then process this list by some other means, identifying how many syllables there are in each word.

Counting sentences would required identifying periods separating lists of words. As of now, TeXcount does no processing of punctuation. However, I guess it be possible to add such a feature to TeXcount without too much programming, although it might not be fully reliable.

A fast and simple short-cut to counting sentences would be to count the number of occurrences of either of the patterns

  [letter][period][space]
  [letter][period][end-of-line]

and hope this would get it roughly right.

2
  • It would be massively inaccurate though. (1) Other punctuation can end sentences. (2) Other stuff can come right before the punctuation (e.g. a citation in brackets). (3) US punctuation pushes the ending punctuation inside closing quotes, even when the punctuation is not part of the quote. (4) UK punctuation puts a footnote marker inside the punctuation (often). I'm not convinced that the estimate would be anything other than misleading. This is not a criticism of your software: I think this would just be a massive - and different - project. (Maybe language dependent.)
    – cfr
    Jan 20 '16 at 0:28
  • @cfr: In some cases, a simple rule like a sequence of word ended by a punctuation mark could work fairly well. In other cases, it could fail miserably. It would depend on the TeX writing style. TeXcount could help in identifying the words and ignore macros and environments that should not be counted as text. However, as cfr points it, analysing the text is not what it is designed for. Jan 21 '16 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.