Package edu.kit.ipd.are.archdoclink.nlp
Class Util
- java.lang.Object
-
- edu.kit.ipd.are.archdoclink.nlp.Util
-
public final class Util extends Object
Utility class that provides some utility functions.- Author:
- Jan Keim
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.collections.api.list.ImmutableList<edu.kit.ipd.parse.luna.graph.INode>getINodesInOrder(edu.kit.ipd.parse.luna.graph.IGraph graph)Returns the "main" INodes in order.static StringgetINodeValue(edu.kit.ipd.parse.luna.graph.INode node)Returns the String value of the attribute "value" for a given node.static StringgetTextFromWords(List<? extends Word> words)static StringgetTextFromWords(Stream<? extends Word> words)static edu.kit.ipd.parse.luna.graph.INodeTypegetTokenINodeType(edu.kit.ipd.parse.luna.graph.IGraph graph)Returns theINodeTypefor "token".static booleannodeHasTokenTypeInIGraph(edu.kit.ipd.parse.luna.graph.IGraph graph, edu.kit.ipd.parse.luna.graph.INode node)Returns whether a given node has type "token" within the given graphstatic doublerelativeDistance(String first, String second)Based on Levenshtein Distance, that then is normalized with the length of the longer String.
-
-
-
Method Detail
-
getINodesInOrder
public static org.eclipse.collections.api.list.ImmutableList<edu.kit.ipd.parse.luna.graph.INode> getINodesInOrder(edu.kit.ipd.parse.luna.graph.IGraph graph)
Returns the "main" INodes in order. This means that "token"-type INodes are collected and returned in a sorted list. Sorting is based on the "next"-arc, starting with the first utterance node.- Parameters:
graph- Graph representing an input- Returns:
- Sorted List of "token"-INodes
-
nodeHasTokenTypeInIGraph
public static boolean nodeHasTokenTypeInIGraph(edu.kit.ipd.parse.luna.graph.IGraph graph, edu.kit.ipd.parse.luna.graph.INode node)Returns whether a given node has type "token" within the given graph- Parameters:
graph- the Graphnode- the Node that should be checked- Returns:
- true if the node has type "token"
-
getTokenINodeType
public static edu.kit.ipd.parse.luna.graph.INodeType getTokenINodeType(edu.kit.ipd.parse.luna.graph.IGraph graph)
Returns theINodeTypefor "token". If the given graph does not have such a type yet, the token is created- Parameters:
graph- Graph to operate on- Returns:
- The
INodeTypefor "token".
-
getINodeValue
public static String getINodeValue(edu.kit.ipd.parse.luna.graph.INode node)
Returns the String value of the attribute "value" for a given node.- Parameters:
node- the node- Returns:
- the String value of the attribute "value" for a given node.
-
-