API documentation
Working with sentences
GreekSyntax.groupsforsentence — FunctionExtract from a vector of VerbalUnitAnnotations all the verbal units that belong to sentence sa.
groupsforsentence(sa, groups)
GreekSyntax.tokensforsentence — FunctionFind all tokens in tknannotations belonging to sentence s.
tokensforsentence(s, tknannotations)
GreekSyntax.sentencesforurn — FunctionFind sentence in a vector sentence annotations containing the token identified by CtsUrn u.
sentencesforurn(u, sentences, tknannotations)
GreekSyntax.sentencerange — FunctionFind 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)
Find CTS URN for range of tokens in tokenlist where tokenlist is a vector of annotated tokens.
sentencerange(tokenlist)
Working with verbal expressions and tokens
GreekSyntax.tokensforgroup — FunctionFind all tokens belonging to a given verbal unit.
tokensforgroup(group, tokens)
GreekSyntax.sentenceforgroup — FunctionFind sentence that group belongs to.
sentenceforgroup(group, sentences)
GreekSyntax.groupfortoken — FunctionFind the VerbalUnitAnnotation object for a given token.
groupfortoken(tkn, groups)
GreekSyntax.sentencefortoken — FunctionFind the SentenceAnnotation for a token t.
sentencefortoken(t, groups, sentences)
Syntactic metrics
GreekSyntax.distance — FunctionFind number of tokens from tkn to its syntactic connection.
distance(tkn, sentence, tknlist)
.
Find number of tokens from tkn to its syntactic connection.
distance(tkn, groups, sentences, tknlist)
.
GreekSyntax.displacement — FunctionFind number of tokens between tkn and its syntactic connection.
displacement(tkn, s, tknlist)
.
Find number of tokens between tkn and its syntactic connection.
displacement(tkn, groups, sentences, tknlist)
.
Find number of other groups occurring within span of grp.
displacement(grp, s, tokens)
Find number of other groups occurring within span of grp.
displacement(grp, sentences, tokens)
GreekSyntax.displacedby — FunctionList other groups appearing between first and last tokens belonging to group grp.
displacedby(grp, s, tokens)
List other groups appearing between first and last tokens belonging to group grp.
displacedby(grp, sentences, tokens)
GreekSyntax.cohesion — FunctionCompute the proportion of tokens within the span of grp that belonging to the group.
cohesion(grp, sentences, tokens)
Compute the proportion of tokens within the span of grp that belonging to the group.
cohesion(grp, s, tokens)
GreekSyntax.span — FunctionFind indexes within lexical tokens of sentence s the first and last token belonging to group grp.
span(grp, s, tokens)
Find indexes within lexical tokens of the sentence grp belongs to of the first and last tokens of group grp.
span(grp, sentences, tokens)
GreekSyntax.spansize — FunctionFind the number of tokens included in the span of grp.
spansize(grp, s, tokens)
Find the number of tokens included in the span of grp.
spansize(grp, sentences, tokens)
GreekSyntax.maxdepth — FunctionFind maximum depth of subordination in sentence s.
maxdepth(s, groups)
GreekSyntax.maxtokendistance — FunctionFind maximum distance between syntactically related tokens in a single sentence.
maxtokendistance(s, tknlist)
GreekSyntax.avgtokendistance — FunctionFind average distance between syntactically related tokens.
avgtokendistance(s, tknlist)
GreekSyntax.maxtokendisplacement — FunctionFind maximum displacement between syntactically related tokens.
maxtokendisplacement(s, tknlist)
GreekSyntax.avgtokendisplacement — FunctionFind average displacement between syntactically related tokens.
avgtokendisplacement(s, tknlist)
GreekSyntax.maxgroupdisplacement — FunctionFind maximum displacement between verbal expressions.
maxgroupdisplacement(s, groups, tokens)
GreekSyntax.avggroupdisplacement — FunctionFind average displacement between verbal expressions.
avggroupdisplacement(s, groups, tokens)
Writing HTML and mermaid diagrams
GreekSyntax.htmltext — FunctionCompose HTML string for tokens included in u.
htmltext(
u,
sentencelist,
tknannotations;
sov,
vucolor,
syntaxtips,
colors,
connectorlist
)
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
)
GreekSyntax.htmltext_indented — FunctionCompose 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
)
GreekSyntax.htmlgroup — FunctionCompose an HTML span for the verbal annotation vu.
htmlgroup(vu; palette)
GreekSyntax.htmlgrouplist — FunctionCompose an HTML ordered list for verbal units belonging to sentence sa.
htmlgrouplist(sa, groups; palette)
Compose an HTML ordered list for the verbal annotations vulist.
htmlgrouplist(vulist; palette)
GreekSyntax.sovkey — FunctionCompose an HTML unordered list illustrating each CSS class used in marking span elements.
sovkey()
GreekSyntax.mermaiddiagram — FunctionCompose diagram in Mermaid format of the syntactic relations in sentence sa. Output formats can be text, jpg, png or svg.
mermaiddiagram(sa, tknannotations; format)
Internal functions (not exported)
Sentences:
GreekSyntax.connectorindexes — FunctionFind a starting and ending index withint tknannotations for connecting words annotated for sentence s.
connectorindexes(s, tknannotations)
GreekSyntax.originindex — FunctionFind index in tknannotations of the first token belonging to sentence s.
originindex(s, tknannotations)
GreekSyntax.sentenceindexfornode — FunctionFind index in a vector sentence annotations of the sentence containing the token identified by CtsUrn leafnode.
sentenceindexfornode(leafnode, sentences, tknannotations)
GreekSyntax.syntactictypes — FunctionFind list of distinct syntactic types in sentence s.
syntactictypes(s, groups)
Tokens:
GreekSyntax.depthfortoken — FunctionFind syntactic depth of token tkn.
depthfortoken(tkn, groups)
GreekSyntax.filterbylevel — FunctionFind all tokens at level of subordination <= depth.
filterbylevel(depth, groups, tokens)
GreekSyntax.passagefromtoken — FunctionMap a TokenAnnotation to a CitablePassage cited at the token level.
passagefromtoken(tkn)
Composing HTML:
GreekSyntax.tipsfortoken — FunctionCompose a tooltips attribute documenting the syntactic relation of token t.
tipsfortoken(t, tkns, isconnector)
GreekSyntax.htmltoken — FunctionCompose 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
)
GreekSyntax.classesfortoken — FunctionCompose an HTML class attribute for a lexical token.
classesfortoken(t, isconnector; syntaxtips, sov)
GreekSyntax.groupcolorforint — FunctionSelect a color to use for item idx by mod'ing a list of colors. Add one to avoid zero indexes.
groupcolorforint(idx; colors)
GreekSyntax.groupcolorfortoken — FunctionChoose a color from a list of colors based on group number component of the token's verbal unit identifier.
groupcolorfortoken(tkn; colors)
GreekSyntax.groupcolor — FunctionChoose a color from a list of colors based on the convention of ending the identifier for a VerbalUnitAnnotation with a number.
groupcolor(vu; colors)
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)