Class WikiTool
java.lang.Object
org.getalp.dbnary.wiki.WikiTool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlocateEnclosedString(String s, String enclosingStringStart, String enclosingStringEnd) This function locates the start and end position of two symbols (enclosingStringStart and enclosingStringEnd) in input String s.Deprecated.Parse the args of a Template, e.g., parses a string like xxx=yyy|zzz=ttt It can handle nested parentheses, e.g., xxx=yyy|zzz={{aaa=bbb|ccc=ddd}}|kkk=hhh and xxx=yyy|zzz=[[aaa|bbb|ccc]]|kkk=hhh.Deprecated.use WikiText packagestatic StringremoveReferencesIn(String definition) static Stringstatic StringsplitUnlessInTemplateOrLink(String s, char c) static StringtoParameterString(Map<String, String> parameterMap)
-
Constructor Details
-
WikiTool
public WikiTool()
-
-
Method Details
-
parseArgs
Deprecated.Parse the args of a Template, e.g., parses a string like xxx=yyy|zzz=ttt It can handle nested parentheses, e.g., xxx=yyy|zzz={{aaa=bbb|ccc=ddd}}|kkk=hhh and xxx=yyy|zzz=[[aaa|bbb|ccc]]|kkk=hhh.- Parameters:
argsString- the String containing all the args (the part of a template contained after the first pipe).- Returns:
- a Map associating each argument name with its value.
-
parseArgs
Deprecated.use WikiText packageParse the args of a Template, e.g., parses a string like xxx=yyy|zzz=ttt It can handle nested parentheses, e.g., xxx=yyy|zzz={{aaa=bbb|ccc=ddd}}|kkk=hhh and xxx=yyy|zzz=[[aaa|bbb|ccc]]|kkk=hhh. If withTemplateName is true, the first argument will be considered as the template name and added to the parseArgs under key "0"- Parameters:
argsString- the String containing all the args (the part of a template contained after the first pipe).withTemplateName- pass true if the argString starts with the template name- Returns:
- a Map associating each argument name with its value.
-
removeReferencesIn
-
removeTablesIn
-
removeTextWithinParenthesesIn
-
locateEnclosedString
public static ArrayList<Span> locateEnclosedString(String s, String enclosingStringStart, String enclosingStringEnd) This function locates the start and end position of two symbols (enclosingStringStart and enclosingStringEnd) in input String s. It can handle nested symbols e.g., locateEnclosedString("string {{at}}","{{","}}") returns (7,13) e.g., locateEnclosedString("string {{at {{position}} }}","{{","}}") returns (7,27)- Parameters:
s- the string to be parsed, this function returns the position of the second parameter enclosingStringStart and the position of the third parameter enclosingStringEnd in string senclosingStringStart- this function returns the position of the String enclosingStringStart in String senclosingStringEnd- this function returns the position of the String enclosingStringEn in String s- Returns:
- an ArrayList with the start and ens positions of the enclosing Strings in input String s
-
splitUnlessInTemplateOrLink
- Parameters:
s- Stringc- character- Returns:
- an ArrayList of String This function takes as input a String s and a character or separator c, and splits s into an ArrayList of Strings using separator c, unless character c falls inside a wiki link or a wiki template
-
toParameterString
-