API documentation

Working with sentences

GreekSyntax.sentencesforurnFunction

Find sentence in a vector sentence annotations containing the token identified by CtsUrn u.

sentencesforurn(u, sentences, tknannotations)
source
GreekSyntax.sentencerangeFunction

Find CTS URN for range of tokens in orthotokens where orthotokens is a vector of analyzed tokens as produced by Orthography's tokenize function.

sentencerange(orthotokens)
source

Find CTS URN for range of tokens in tokenlist where tokenlist is a vector of annotated tokens.

sentencerange(tokenlist)
source

Working with verbal expressions and tokens

Syntactic metrics

GreekSyntax.distanceFunction

Find number of tokens from tkn to its syntactic connection.

distance(tkn, sentence, tknlist)

.

source

Find number of tokens from tkn to its syntactic connection.

distance(tkn, groups, sentences, tknlist)

.

source
GreekSyntax.displacementFunction

Find number of tokens between tkn and its syntactic connection.

displacement(tkn, s, tknlist)

.

source

Find number of tokens between tkn and its syntactic connection.

displacement(tkn, groups, sentences, tknlist)

.

source

Find number of other groups occurring within span of grp.

displacement(grp, s, tokens)
source

Find number of other groups occurring within span of grp.

displacement(grp, sentences, tokens)
source
GreekSyntax.displacedbyFunction

List other groups appearing between first and last tokens belonging to group grp.

displacedby(grp, s, tokens)
source

List other groups appearing between first and last tokens belonging to group grp.

displacedby(grp, sentences, tokens)
source
GreekSyntax.cohesionFunction

Compute the proportion of tokens within the span of grp that belonging to the group.

cohesion(grp, sentences, tokens)
source

Compute the proportion of tokens within the span of grp that belonging to the group.

cohesion(grp, s, tokens)
source
GreekSyntax.spanFunction

Find indexes within lexical tokens of sentence s the first and last token belonging to group grp.

span(grp, s, tokens)
source

Find indexes within lexical tokens of the sentence grp belongs to of the first and last tokens of group grp.

span(grp, sentences, tokens)
source
GreekSyntax.spansizeFunction

Find the number of tokens included in the span of grp.

spansize(grp, s, tokens)
source

Find the number of tokens included in the span of grp.

spansize(grp, sentences, tokens)
source

Writing HTML and mermaid diagrams

GreekSyntax.htmltextFunction

Compose HTML string for tokens included in u.

htmltext(
    u,
    sentencelist,
    tknannotations;
    sov,
    vucolor,
    syntaxtips,
    colors,
    connectorlist
)
source

Compose HTML string for the annotated sentence sa using data from a vector of token annotations. Boolean flags for sov and vucolor provoke CSS additions for Subject-Object-Verb highlight, and for color coding by verbal unit.

htmltext(
    sa,
    tknannotations;
    sov,
    vucolor,
    colors,
    syntaxtips,
    connectorids
)
source
GreekSyntax.htmltext_indentedFunction

Compose HTML string for the annotated sentence sa indented by level of subordination. Formatting relies on data from a vector of token annotations and annotations on verbal units.

htmltext_indented(
    sa,
    groups,
    tknannotations;
    sov,
    vucolor,
    palette,
    syntaxtips,
    connectorids
)
source
GreekSyntax.htmlgrouplistFunction

Compose an HTML ordered list for verbal units belonging to sentence sa.

htmlgrouplist(sa, groups; palette)
source

Compose an HTML ordered list for the verbal annotations vulist.

htmlgrouplist(vulist; palette)
source
GreekSyntax.sovkeyFunction

Compose an HTML unordered list illustrating each CSS class used in marking span elements.

sovkey()
source
GreekSyntax.mermaiddiagramFunction

Compose diagram in Mermaid format of the syntactic relations in sentence sa. Output formats can be text, jpg, png or svg.

mermaiddiagram(sa, tknannotations; format)
source

Internal functions (not exported)

Sentences:

GreekSyntax.connectorindexesFunction

Find a starting and ending index withint tknannotations for connecting words annotated for sentence s.

connectorindexes(s, tknannotations)
source
GreekSyntax.originindexFunction

Find index in tknannotations of the first token belonging to sentence s.

originindex(s, tknannotations)
source
GreekSyntax.sentenceindexfornodeFunction

Find index in a vector sentence annotations of the sentence containing the token identified by CtsUrn leafnode.

sentenceindexfornode(leafnode, sentences, tknannotations)
source

Tokens:

Composing HTML:

GreekSyntax.tipsfortokenFunction

Compose a tooltips attribute documenting the syntactic relation of token t.

tipsfortoken(t, tkns, isconnector)
source
GreekSyntax.htmltokenFunction

Compose string for a token, wrapping lexical tokens in an HTML span. Based on lexical type and context indicated by inprefix flag, prefixes the resulting string with a leading space or not.

htmltoken(
    t,
    tokens,
    inprefix,
    connectingword,
    add_sov,
    add_color;
    colors,
    syntaxtips
)
source
GreekSyntax.groupcolorforintFunction

Select a color to use for item idx by mod'ing a list of colors. Add one to avoid zero indexes.

groupcolorforint(idx; colors)
source
GreekSyntax.groupcolorfortokenFunction

Choose a color from a list of colors based on group number component of the token's verbal unit identifier.

groupcolorfortoken(tkn; colors)
source
GreekSyntax.groupcolorFunction

Choose a color from a list of colors based on the convention of ending the identifier for a VerbalUnitAnnotation with a number.

groupcolor(vu; colors)
source

Choose a color from a list of colors based on the convention of ending the identifier for a VerbalUnitAnnotation with a number.

groupcolor(groupid; colors)
source