PHPCLANCHILDES with regular expressions

How a search works

Every utterance is tested as the line it is in the transcript, with its label: *CHI: dove la metto ?. Searching “%mor tier” tests %mor: adv|dove pro:clit|la …. A line that continues on the next row of the file is joined to it first. The speaker menu restricts the search to some speakers; the scope panel to some folders, file names or ages.

Patterns are PCRE, the regular expressions of PHP. Everything that worked with grep -E works here, including [[:space:]], [[:punct:]] and [[:alpha:]]; you can paste a whole old command (grep -i -n -B3 -A3 -E '…' | grep -v …) and it is converted into the form.

The essentials

casathe letters c-a-s-a anywhere in the line: casa, but also casale and accasare
\bcasa\bcasa as a whole word (\b is a word boundary; accented letters count as letters)
.any one character; \. is a real full stop
[aeiou]one of these characters; [^aeiou] any character but these; [a-z] a range
\p{L}any letter, accented ones included (like [[:alpha:]]); \d a digit; \s a space or tab
a* a+ a? a{2,3}zero or more, one or more, zero or one, two or three times the previous item
(io|tu|lui)alternatives; the parentheses group them
^ $start and end of the line (in “Other % tiers” and “All tiers”, of each tier line)
\p{L}+are\ba word ending in -are
(?<!\p{L})ri\p{L}+words starting with ri- ((?<!…): not preceded by…)

CHAT characters to escape

Many CHAT codes use characters that have a meaning in regular expressions. Put a backslash before them to search for them literally: \[//\] finds retracings, \[: replacements, \+\.\.\. trailing off, \(\.\) a pause, &=ride laughing, \? the question mark. Inside square brackets most characters are already literal: [?!.].

Main line or words only?

“Main line” is the line as transcribed, codes included: chede [: schede] .. “Main line, words only” is the same line without codes, fillers (&eh), fragments, omitted words (0è), xxx, pauses and annotations: chede .. Use it when a code between two words would break your pattern (la [/] la palla). Word frequencies, MLU and the “per 1,000 words” rates are computed on this cleaned line.

Reading the numbers

The ready-made searches

\bche\b Italian, words: “che” (relatives, complementizers…)
Every “che” as a whole word. Relatives, complementizers and interrogative “che” all match: the context tells them apart.
\b(che|chi|cosa|dove|quando|come|perch[eéè]|quale|quali|quanto|quanta|quanti|quante)\b
and \?
Italian, words: wh- questions
Interrogative words in utterances that contain a question mark.
\bperch[eéè]\b Italian, words: “perché”
The bracket accepts the accent typed in any way (perche, perché, perchè).
\b\p{L}+[aiu]t[oaie]\b Italian, words: past participles (by ending)
Words in -ato/-ito/-uto and their feminine and plural forms. Expect false positives (dito, patate) and misses (fatto, detto): compare with the %mor version.
\b\p{L}*[aei]v(o|i|a|amo|ate|ano)\b|\ber(o|i|a|avamo|avate|ano)\b
not \b([dbl][lrea]a?v[oaei](te)?|(sc|ar)riv[ioea]|cattiv\p{L}*|(copri)?divan\p{L}*|s?c?h?i?av[iaeo]|\p{L}*[ae]tevi)\b
Italian, words: imperfetto (by ending)
The old preset: forms in -avo/-evo/-ivo… and “ero”; the second pattern removes utterances with bravo, arrivo, cattivo, divano, chiave… (like grep -v, it drops the whole utterance).
\b(dev[oie]|devono|dobbiamo|dovete|poss(o|ono|iamo)|puoi|pu[oò]|potete|vogli(o|amo|ono)|vuoi|vuole|volete)\b Italian, words: modal verbs
Present-tense forms of dovere, potere, volere.
\bs[ei] ?n+[oò]\b Italian, words: “sennò” (if not)
sennò, se no, senno, sinnò…
[\w:]+\|[^\s=]+-PPART[^\s=]* Italian, %mor tier: past participles (%mor tier)
Morphological tags instead of endings: every word analysed as a past participle (PPART), irregular ones included.
[\w:]+\|[^\s=]+-[123][SP]&PAST Italian, %mor tier: imperfetto (%mor tier)
In the Italian MOR grammar, PAST is the imperfetto (era = esse-3S&PAST); IMP is the imperative.
v\|(pote|dove|vole)-[^\s=]* Italian, %mor tier: modal verbs (%mor tier)
Any form of potere, dovere, volere (the stems are pote-, dove-, vole-).
pro:clit\|[^\s=~]+ Italian, %mor tier: clitic pronouns (%mor tier)
Clitics, also when attached to the verb (mette-INF~pro:clit|…).
\b(what|who|where|when|why|how|which|whose)('s)?\b
and \?
English: wh- questions
Wh-words in utterances that contain a question mark.
[\w:]+\|[^\s=]+-PROG English: progressive -ing (%mor) (%mor tier)
Verbs tagged as progressive participles.
[\w:]+\|[^\s=]+[&-]PAST\b English: past tense (%mor) (%mor tier)
Regular (-PAST) and irregular (&PAST) past tense.
\[/{1,3}\] CHAT codes: repetitions and retracings
[/] repetition, [//] retracing, [///] reformulation. Brackets and slashes are escaped or used literally inside [ ].
\S+ \[: [^\]]+\] CHAT codes: replacements [: target]
What the speaker said, followed by the target form: chede [: schede].
\b(xxx|yyy|xx)\b CHAT codes: unintelligible speech
xxx is unintelligible, yyy is transcribed phonetically on %pho.
(^|\s)0\p{L}+ CHAT codes: omitted words (0word)
Words coded as omitted, like 0è or 0is.
\s\?(\s|$) CHAT codes: questions
Utterances ending with the question terminator.

From grep to here

grep -i -n -B3 -A3 -E '([[:space:]]|[[:punct:]])perch' files…

becomes the pattern ([[:space:]]|[[:punct:]])perch with “Ignore case” on and a context of ±3 utterances. A second | grep -E '…' goes in “must also match”, a | grep -v '…' in “must not match”. Instead of CHI: inside the pattern, choose the speaker in the menu.