public class Helper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Helper.CoveredMatchesCalculator
Marks all nodes which are dominated by already marked nodes.
1.
|
| Modifier and Type | Field and Description |
|---|---|
static com.google.common.escape.Escaper |
AQL_REGEX_VALUE_ESCAPER |
static String |
CORPUS_FONT |
static String |
CORPUS_FONT_FORCE |
static String |
DEFAULT_CONFIG |
| Constructor and Description |
|---|
Helper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addMatchToDocumentGraph(Match match,
org.corpus_tools.salt.common.SDocumentGraph documentGraph) |
static String |
buildDocumentQuery(List<String> docPath,
List<String> nodeAnnoFilter,
boolean useRawText)
Build a query that includes all (possible filtered by name) node of the document.
|
static Map<org.corpus_tools.salt.core.SNode,Long> |
calculateMarkedAndCovered(org.corpus_tools.salt.common.SDocument doc,
List<org.corpus_tools.salt.core.SNode> segNodes,
String segmentationName) |
static boolean |
checkSLayer(String layerName,
org.corpus_tools.salt.core.SNode node)
Checks a
SNode if it is member of a specific SLayer. |
static boolean |
containsRTLText(String str)
Detects arabic characters in a string.
|
static String |
convertExceptionToMessage(Throwable ex)
Returns a formatted string containing the type of the exception, the message and the
stacktrace.
|
static org.apache.commons.mail.MultiPartEmail |
createEMailFromConfiguration(UIConfig config)
Creates a pre-configured email object from the configuration.
|
static Map<org.corpus_tools.salt.common.SToken,Integer> |
createToken2IndexMap(org.corpus_tools.salt.common.SDocumentGraph graph,
org.corpus_tools.salt.common.STextualDS textualDS) |
static String |
encodeBase64URL(String val) |
static elemental.json.JsonValue |
encodeGeneric(Object v) |
static String |
generateCorpusLink(Set<String> corpora) |
static ApiClient |
getClient(com.vaadin.ui.UI ui) |
static CorpusConfiguration |
getCorpusConfig(String corpus,
com.vaadin.ui.UI ui)
Loads the corpus config of a specific corpus.
|
static List<String> |
getCorpusPath(org.corpus_tools.salt.common.SCorpusGraph corpusGraph,
org.corpus_tools.salt.common.SDocument doc) |
static List<String> |
getCorpusPath(String uri) |
static CorpusConfiguration |
getDefaultCorpusConfig() |
static String |
getDisplayName(org.springframework.security.oauth2.core.oidc.user.OidcUser user) |
static com.google.common.collect.Range<Integer> |
getLeftRightSpan(org.corpus_tools.salt.core.SNode node,
org.corpus_tools.salt.common.SDocumentGraph graph,
Map<org.corpus_tools.salt.common.SToken,Integer> token2index) |
static Set<AnnoKey> |
getMetaAnnotationNames(String corpus,
com.vaadin.ui.UI ui) |
static List<org.corpus_tools.salt.core.SMetaAnnotation> |
getMetaData(String toplevelCorpusName,
Optional<String> documentName,
com.vaadin.ui.UI ui)
Retrieve all the meta data for a given document of a corpus including the metadata of all
corora in the path to the document.
|
static List<org.corpus_tools.salt.core.SMetaAnnotation> |
getMetaDataDoc(String toplevelCorpusName,
String documentName,
com.vaadin.ui.UI ui)
Retrieve the meta data for a given document of a corpus.
|
static String |
getQName(AnnoKey key) |
static String |
getQName(Component c) |
static String |
getQualifiedName(org.corpus_tools.salt.core.SAnnotation anno)
Get the qualified name separated by a single ":" when a namespace exists.
|
static List<org.corpus_tools.salt.core.SNode> |
getSortedSegmentationNodes(String segName,
org.corpus_tools.salt.common.SDocumentGraph graph)
Calculates a
SOrderRelation node chain of a SDocumentGraph. |
static String |
getSpannedText(org.corpus_tools.salt.common.SToken tok)
Gets the spannend/covered text for a token.
|
static org.corpus_tools.salt.common.STextualDS |
getTextualDSForNode(org.corpus_tools.salt.core.SNode node,
org.corpus_tools.salt.common.SDocumentGraph graph)
Finds the
STextualDS for a given node. |
static Set<String> |
getTokenAnnotationLevelSet(org.corpus_tools.salt.common.SaltProject p) |
static Set<String> |
getTokenAnnotationLevelSet(org.corpus_tools.salt.common.SDocumentGraph graph) |
static Set<String> |
getToplevelCorpusNames(org.corpus_tools.salt.common.SaltProject p)
Gets all names of a corpus from a salt project.
|
static Optional<org.springframework.security.oauth2.core.oidc.user.OidcUser> |
getUser(org.springframework.security.core.context.SecurityContext context) |
static Optional<org.springframework.security.oauth2.core.oidc.user.OidcUser> |
getUser(com.vaadin.ui.UI ui) |
static Map<String,String> |
parseFragment(String fragment)
Parses the fragment.
|
public static final String DEFAULT_CONFIG
public static final String CORPUS_FONT_FORCE
public static final String CORPUS_FONT
public static final com.google.common.escape.Escaper AQL_REGEX_VALUE_ESCAPER
public static List<String> getCorpusPath(org.corpus_tools.salt.common.SCorpusGraph corpusGraph, org.corpus_tools.salt.common.SDocument doc)
public static Map<org.corpus_tools.salt.core.SNode,Long> calculateMarkedAndCovered(org.corpus_tools.salt.common.SDocument doc, List<org.corpus_tools.salt.core.SNode> segNodes, String segmentationName)
public static String convertExceptionToMessage(Throwable ex)
ex - Exceptionpublic static ApiClient getClient(com.vaadin.ui.UI ui)
public static Set<AnnoKey> getMetaAnnotationNames(String corpus, com.vaadin.ui.UI ui) throws ApiException
ApiExceptionpublic static Map<org.corpus_tools.salt.common.SToken,Integer> createToken2IndexMap(org.corpus_tools.salt.common.SDocumentGraph graph, org.corpus_tools.salt.common.STextualDS textualDS)
public static elemental.json.JsonValue encodeGeneric(Object v)
public static CorpusConfiguration getCorpusConfig(String corpus, com.vaadin.ui.UI ui)
corpus - The name of the corpus, for which the config is fetched.CorpusConfig object, which wraps a Properties object. This Properties
object stores the corpus configuration as simple key-value pairs.public static CorpusConfiguration getDefaultCorpusConfig()
public static com.google.common.collect.Range<Integer> getLeftRightSpan(org.corpus_tools.salt.core.SNode node, org.corpus_tools.salt.common.SDocumentGraph graph, Map<org.corpus_tools.salt.common.SToken,Integer> token2index)
public static List<org.corpus_tools.salt.core.SMetaAnnotation> getMetaData(String toplevelCorpusName, Optional<String> documentName, com.vaadin.ui.UI ui)
toplevelCorpusName - Specifies the the toplevel corpusdocumentName - Specifies the document or leave empty if only the corpus meta data should
be fetched.public static List<org.corpus_tools.salt.core.SMetaAnnotation> getMetaDataDoc(String toplevelCorpusName, String documentName, com.vaadin.ui.UI ui)
toplevelCorpusName - specifies the toplevel corpusdocumentName - specifies the document.public static String getQualifiedName(org.corpus_tools.salt.core.SAnnotation anno)
anno - annotationpublic static Optional<org.springframework.security.oauth2.core.oidc.user.OidcUser> getUser(com.vaadin.ui.UI ui)
public static Optional<org.springframework.security.oauth2.core.oidc.user.OidcUser> getUser(org.springframework.security.core.context.SecurityContext context)
public static String getDisplayName(org.springframework.security.oauth2.core.oidc.user.OidcUser user)
public static void addMatchToDocumentGraph(Match match, org.corpus_tools.salt.common.SDocumentGraph documentGraph)
public static List<org.corpus_tools.salt.core.SNode> getSortedSegmentationNodes(String segName, org.corpus_tools.salt.common.SDocumentGraph graph)
SOrderRelation node chain of a SDocumentGraph.
If no segmentation name is set, a list of sorted SToken will be returned.
segName - The segmentation name, for which the chain is computed.graph - The salt document graph, which is traversed for the segmentation.SNode, which is sorted by the SOrderRelation.public static boolean containsRTLText(String str)
Every character is checked, if its bit representation lies between:
[1425, 1785] | [64286, 65019] | [65136, 65276]
str - The string to be checked.public static String getSpannedText(org.corpus_tools.salt.common.SToken tok)
STextualRelation edges
for a SToken from the SDocumentGraph and calculates the appropiate substring
from the STextualDS.tok - The SToken which is overlapping the text sequence.String object, if there is no STextualRelationpublic static org.corpus_tools.salt.common.STextualDS getTextualDSForNode(org.corpus_tools.salt.core.SNode node,
org.corpus_tools.salt.common.SDocumentGraph graph)
STextualDS for a given node. The node must dominate a token of this text.node - Salt node to find the textual data source forgraph - document graphpublic static Set<String> getTokenAnnotationLevelSet(org.corpus_tools.salt.common.SaltProject p)
public static Set<String> getTokenAnnotationLevelSet(org.corpus_tools.salt.common.SDocumentGraph graph)
public static boolean checkSLayer(String layerName, org.corpus_tools.salt.core.SNode node)
SNode if it is member of a specific SLayer.layerName - Specifies the layername to check.node - Specifies the node to check.public static Set<String> getToplevelCorpusNames(org.corpus_tools.salt.common.SaltProject p)
p - Salt projectpublic static Map<String,String> parseFragment(String fragment)
fragment - fragment to parsepublic static String buildDocumentQuery(List<String> docPath, List<String> nodeAnnoFilter, boolean useRawText)
docPath - the path of the documentnodeAnnoFilter - A list of node annotation names for filtering the nodes or null if no
filtering should be applied.useRawText - If true, only extract the original raw textpublic static org.apache.commons.mail.MultiPartEmail createEMailFromConfiguration(UIConfig config) throws org.apache.commons.mail.EmailException, UnknownHostException
config - org.apache.commons.mail.EmailExceptionUnknownHostException - Thrown when the "mailFrom" property is not set and the localhost
host name can't be determined.Copyright © 2021 Corpuslinguistic working group Humboldt University Berlin. All rights reserved.