id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
55,700
rometools/rome
rome-modules/src/main/java/com/rometools/modules/sle/SleUtility.java
SleUtility.sort
public static <T extends Extendable> List<T> sort(final List<T> values, final Sort sort, final boolean ascending) { final SortableList<T> list = getSortableList(values); list.sortOnProperty(sort, ascending, new SortStrategy()); return list; }
java
public static <T extends Extendable> List<T> sort(final List<T> values, final Sort sort, final boolean ascending) { final SortableList<T> list = getSortableList(values); list.sortOnProperty(sort, ascending, new SortStrategy()); return list; }
[ "public", "static", "<", "T", "extends", "Extendable", ">", "List", "<", "T", ">", "sort", "(", "final", "List", "<", "T", ">", "values", ",", "final", "Sort", "sort", ",", "final", "boolean", "ascending", ")", "{", "final", "SortableList", "<", "T", ...
Sorts a list of values based on a given sort field using a selection sort. @param values List of values (implements Extendable) to sort. @param sort The sort field to sort on. @param ascending Sort ascending/descending. @return Sorted list of values
[ "Sorts", "a", "list", "of", "values", "based", "on", "a", "given", "sort", "field", "using", "a", "selection", "sort", "." ]
5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/sle/SleUtility.java#L75-L79
55,701
rometools/rome
rome-modules/src/main/java/com/rometools/modules/sle/SleUtility.java
SleUtility.sortAndGroup
public static <T extends Extendable> List<T> sortAndGroup(final List<T> values, final Group[] groups, final Sort sort, final boolean ascending) { List<T> list = sort(values, sort, ascending); list = group(list, groups); return list; }
java
public static <T extends Extendable> List<T> sortAndGroup(final List<T> values, final Group[] groups, final Sort sort, final boolean ascending) { List<T> list = sort(values, sort, ascending); list = group(list, groups); return list; }
[ "public", "static", "<", "T", "extends", "Extendable", ">", "List", "<", "T", ">", "sortAndGroup", "(", "final", "List", "<", "T", ">", "values", ",", "final", "Group", "[", "]", "groups", ",", "final", "Sort", "sort", ",", "final", "boolean", "ascendi...
Sorts and groups a set of entries. @param values List of Extendable implementations. @param groups Group items to group by. @param sort Field to sort on. @param ascending Sort ascending/descending @return Grouped and sorted list of entries.
[ "Sorts", "and", "groups", "a", "set", "of", "entries", "." ]
5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/sle/SleUtility.java#L90-L94
55,702
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/client/AtomClientFactory.java
AtomClientFactory.getAtomService
public static ClientAtomService getAtomService(final String uri, final AuthStrategy authStrategy) throws ProponoException { return new ClientAtomService(uri, authStrategy); }
java
public static ClientAtomService getAtomService(final String uri, final AuthStrategy authStrategy) throws ProponoException { return new ClientAtomService(uri, authStrategy); }
[ "public", "static", "ClientAtomService", "getAtomService", "(", "final", "String", "uri", ",", "final", "AuthStrategy", "authStrategy", ")", "throws", "ProponoException", "{", "return", "new", "ClientAtomService", "(", "uri", ",", "authStrategy", ")", ";", "}" ]
Create AtomService by reading service doc from Atom Server.
[ "Create", "AtomService", "by", "reading", "service", "doc", "from", "Atom", "Server", "." ]
5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/client/AtomClientFactory.java#L40-L42
55,703
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/client/AtomClientFactory.java
AtomClientFactory.getCollection
public static ClientCollection getCollection(final String uri, final AuthStrategy authStrategy) throws ProponoException { return new ClientCollection(uri, authStrategy); }
java
public static ClientCollection getCollection(final String uri, final AuthStrategy authStrategy) throws ProponoException { return new ClientCollection(uri, authStrategy); }
[ "public", "static", "ClientCollection", "getCollection", "(", "final", "String", "uri", ",", "final", "AuthStrategy", "authStrategy", ")", "throws", "ProponoException", "{", "return", "new", "ClientCollection", "(", "uri", ",", "authStrategy", ")", ";", "}" ]
Create ClientCollection bound to URI.
[ "Create", "ClientCollection", "bound", "to", "URI", "." ]
5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/client/AtomClientFactory.java#L47-L49
55,704
rometools/rome
rome-modules/src/main/java/com/rometools/modules/mediarss/types/MediaContent.java
MediaContent.setReference
public void setReference(final Reference reference) { this.reference = reference; if (reference instanceof PlayerReference) { setPlayer((PlayerReference) reference); } }
java
public void setReference(final Reference reference) { this.reference = reference; if (reference instanceof PlayerReference) { setPlayer((PlayerReference) reference); } }
[ "public", "void", "setReference", "(", "final", "Reference", "reference", ")", "{", "this", ".", "reference", "=", "reference", ";", "if", "(", "reference", "instanceof", "PlayerReference", ")", "{", "setPlayer", "(", "(", "PlayerReference", ")", "reference", ...
The player or URL reference for the item @param reference The player or URL reference for the item
[ "The", "player", "or", "URL", "reference", "for", "the", "item" ]
5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/types/MediaContent.java#L481-L487
55,705
dequelabs/axe-selenium-java
src/main/java/com/deque/axe/AXE.java
AXE.inject
public static void inject(final WebDriver driver, final URL scriptUrl, Boolean skipFrames) { final String script = getContents(scriptUrl); if (!skipFrames) { final ArrayList<WebElement> parents = new ArrayList<WebElement>(); injectIntoFrames(driver, script, parents); } JavascriptExecutor js = (Javascrip...
java
public static void inject(final WebDriver driver, final URL scriptUrl, Boolean skipFrames) { final String script = getContents(scriptUrl); if (!skipFrames) { final ArrayList<WebElement> parents = new ArrayList<WebElement>(); injectIntoFrames(driver, script, parents); } JavascriptExecutor js = (Javascrip...
[ "public", "static", "void", "inject", "(", "final", "WebDriver", "driver", ",", "final", "URL", "scriptUrl", ",", "Boolean", "skipFrames", ")", "{", "final", "String", "script", "=", "getContents", "(", "scriptUrl", ")", ";", "if", "(", "!", "skipFrames", ...
Recursively injects a script to the top level document with the option to skip iframes. @param driver WebDriver instance to inject into @param scriptUrl URL to the script to inject @param skipFrames True if the script should not be injected into iframes
[ "Recursively", "injects", "a", "script", "to", "the", "top", "level", "document", "with", "the", "option", "to", "skip", "iframes", "." ]
68b35ff46c59111b0e9a9f573380c3d250bcfd65
https://github.com/dequelabs/axe-selenium-java/blob/68b35ff46c59111b0e9a9f573380c3d250bcfd65/src/main/java/com/deque/axe/AXE.java#L69-L80
55,706
dequelabs/axe-selenium-java
src/main/java/com/deque/axe/AXE.java
AXE.injectIntoFrames
private static void injectIntoFrames(final WebDriver driver, final String script, final ArrayList<WebElement> parents) { final JavascriptExecutor js = (JavascriptExecutor) driver; final List<WebElement> frames = driver.findElements(By.tagName("iframe")); for (WebElement frame : frames) { driver.switchTo().def...
java
private static void injectIntoFrames(final WebDriver driver, final String script, final ArrayList<WebElement> parents) { final JavascriptExecutor js = (JavascriptExecutor) driver; final List<WebElement> frames = driver.findElements(By.tagName("iframe")); for (WebElement frame : frames) { driver.switchTo().def...
[ "private", "static", "void", "injectIntoFrames", "(", "final", "WebDriver", "driver", ",", "final", "String", "script", ",", "final", "ArrayList", "<", "WebElement", ">", "parents", ")", "{", "final", "JavascriptExecutor", "js", "=", "(", "JavascriptExecutor", "...
Recursively find frames and inject a script into them. @param driver An initialized WebDriver @param script Script to inject @param parents A list of all toplevel frames
[ "Recursively", "find", "frames", "and", "inject", "a", "script", "into", "them", "." ]
68b35ff46c59111b0e9a9f573380c3d250bcfd65
https://github.com/dequelabs/axe-selenium-java/blob/68b35ff46c59111b0e9a9f573380c3d250bcfd65/src/main/java/com/deque/axe/AXE.java#L97-L118
55,707
dequelabs/axe-selenium-java
src/main/java/com/deque/axe/AXE.java
AXE.writeResults
public static void writeResults(final String name, final Object output) { Writer writer = null; try { writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(name + ".json"), "utf-8")); writer.write(output.toString()); } catch (IOException ignored) { } finally { try {write...
java
public static void writeResults(final String name, final Object output) { Writer writer = null; try { writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(name + ".json"), "utf-8")); writer.write(output.toString()); } catch (IOException ignored) { } finally { try {write...
[ "public", "static", "void", "writeResults", "(", "final", "String", "name", ",", "final", "Object", "output", ")", "{", "Writer", "writer", "=", "null", ";", "try", "{", "writer", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "new", ...
Writes a raw object out to a JSON file with the specified name. @param name Desired filename, sans extension @param output Object to write. Most useful if you pass in either the Builder.analyze() response or the violations array it contains.
[ "Writes", "a", "raw", "object", "out", "to", "a", "JSON", "file", "with", "the", "specified", "name", "." ]
68b35ff46c59111b0e9a9f573380c3d250bcfd65
https://github.com/dequelabs/axe-selenium-java/blob/68b35ff46c59111b0e9a9f573380c3d250bcfd65/src/main/java/com/deque/axe/AXE.java#L212-L226
55,708
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SynonymsEntry.java
SynonymsEntry.add
public void add(IWord word) { //check and extends the entity from the base word if ( word.getEntity() == null ) { word.setEntity(rootWord.getEntity()); } //check and extends the part of speech from the base word if ( word.getPartSpeech() == null ) { ...
java
public void add(IWord word) { //check and extends the entity from the base word if ( word.getEntity() == null ) { word.setEntity(rootWord.getEntity()); } //check and extends the part of speech from the base word if ( word.getPartSpeech() == null ) { ...
[ "public", "void", "add", "(", "IWord", "word", ")", "{", "//check and extends the entity from the base word", "if", "(", "word", ".", "getEntity", "(", ")", "==", "null", ")", "{", "word", ".", "setEntity", "(", "rootWord", ".", "getEntity", "(", ")", ")", ...
add a new synonyms word and the newly added word will extends the part of speech and the entity from the base word if there are not set @param word
[ "add", "a", "new", "synonyms", "word", "and", "the", "newly", "added", "word", "will", "extends", "the", "part", "of", "speech", "and", "the", "entity", "from", "the", "base", "word", "if", "there", "are", "not", "set" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SynonymsEntry.java#L72-L86
55,709
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/NumericUtil.java
NumericUtil.isCNNumeric
public static int isCNNumeric( char c ) { Integer i = cnNumeric.get(c); if ( i == null ) return -1; return i.intValue(); }
java
public static int isCNNumeric( char c ) { Integer i = cnNumeric.get(c); if ( i == null ) return -1; return i.intValue(); }
[ "public", "static", "int", "isCNNumeric", "(", "char", "c", ")", "{", "Integer", "i", "=", "cnNumeric", ".", "get", "(", "c", ")", ";", "if", "(", "i", "==", "null", ")", "return", "-", "1", ";", "return", "i", ".", "intValue", "(", ")", ";", "...
check if the given char is a Chinese numeric or not @param c @return int the numeric value
[ "check", "if", "the", "given", "char", "is", "a", "Chinese", "numeric", "or", "not" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/NumericUtil.java#L54-L59
55,710
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/NumericUtil.java
NumericUtil.isCNNumericString
public static boolean isCNNumericString(String str , int sIdx, int eIdx) { for ( int i = sIdx; i < eIdx; i++ ) { if ( ! cnNumeric.containsKey(str.charAt(i)) ) { return false; } } return true; }
java
public static boolean isCNNumericString(String str , int sIdx, int eIdx) { for ( int i = sIdx; i < eIdx; i++ ) { if ( ! cnNumeric.containsKey(str.charAt(i)) ) { return false; } } return true; }
[ "public", "static", "boolean", "isCNNumericString", "(", "String", "str", ",", "int", "sIdx", ",", "int", "eIdx", ")", "{", "for", "(", "int", "i", "=", "sIdx", ";", "i", "<", "eIdx", ";", "i", "++", ")", "{", "if", "(", "!", "cnNumeric", ".", "c...
check if the specified string is a Chinese numeric string @param str @return boolean
[ "check", "if", "the", "specified", "string", "is", "a", "Chinese", "numeric", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/NumericUtil.java#L67-L75
55,711
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegController.java
JcsegController.response
protected void response( int code, String data ) { /* * send the json content type and the charset */ response.setContentType("application/json;charset="+config.getCharset()); JSONWriter json = JSONWriter.create() .put("code", code) ...
java
protected void response( int code, String data ) { /* * send the json content type and the charset */ response.setContentType("application/json;charset="+config.getCharset()); JSONWriter json = JSONWriter.create() .put("code", code) ...
[ "protected", "void", "response", "(", "int", "code", ",", "String", "data", ")", "{", "/*\n * send the json content type and the charset \n */", "response", ".", "setContentType", "(", "\"application/json;charset=\"", "+", "config", ".", "getCharset", "(", ...
global output protocol @param code @param data
[ "global", "output", "protocol" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegController.java#L46-L74
55,712
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegController.java
JcsegController.response
protected void response(int code, List<Object> data) { response(code, JSONWriter.list2JsonString(data)); }
java
protected void response(int code, List<Object> data) { response(code, JSONWriter.list2JsonString(data)); }
[ "protected", "void", "response", "(", "int", "code", ",", "List", "<", "Object", ">", "data", ")", "{", "response", "(", "code", ",", "JSONWriter", ".", "list2JsonString", "(", "data", ")", ")", ";", "}" ]
global list output protocol @param code @param data
[ "global", "list", "output", "protocol" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegController.java#L82-L85
55,713
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegController.java
JcsegController.response
protected void response(int code, Map<String, Object> data) { response(code, JSONWriter.map2JsonString(data)); }
java
protected void response(int code, Map<String, Object> data) { response(code, JSONWriter.map2JsonString(data)); }
[ "protected", "void", "response", "(", "int", "code", ",", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "response", "(", "code", ",", "JSONWriter", ".", "map2JsonString", "(", "data", ")", ")", ";", "}" ]
global map output protocol @param code @param data
[ "global", "map", "output", "protocol" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegController.java#L104-L107
55,714
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java
JSONWriter.put
public JSONWriter put(String key, Object obj) { data.put(key, obj); return this; }
java
public JSONWriter put(String key, Object obj) { data.put(key, obj); return this; }
[ "public", "JSONWriter", "put", "(", "String", "key", ",", "Object", "obj", ")", "{", "data", ".", "put", "(", "key", ",", "obj", ")", ";", "return", "this", ";", "}" ]
put a new mapping with a string @param key @param obj
[ "put", "a", "new", "mapping", "with", "a", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java#L45-L49
55,715
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java
JSONWriter.put
public JSONWriter put(String key, Object[] vector) { data.put(key, vector2JsonString(vector)); return this; }
java
public JSONWriter put(String key, Object[] vector) { data.put(key, vector2JsonString(vector)); return this; }
[ "public", "JSONWriter", "put", "(", "String", "key", ",", "Object", "[", "]", "vector", ")", "{", "data", ".", "put", "(", "key", ",", "vector2JsonString", "(", "vector", ")", ")", ";", "return", "this", ";", "}" ]
put a new mapping with a vector @param key @param vector
[ "put", "a", "new", "mapping", "with", "a", "vector" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java#L57-L61
55,716
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java
JSONWriter.vector2JsonString
@SuppressWarnings("unchecked") public static String vector2JsonString(Object[] vector) { IStringBuffer sb = new IStringBuffer(); sb.append('['); for ( Object o : vector ) { if ( o instanceof List<?> ) { sb.append(list2JsonString((List<Object>)o)).appen...
java
@SuppressWarnings("unchecked") public static String vector2JsonString(Object[] vector) { IStringBuffer sb = new IStringBuffer(); sb.append('['); for ( Object o : vector ) { if ( o instanceof List<?> ) { sb.append(list2JsonString((List<Object>)o)).appen...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "String", "vector2JsonString", "(", "Object", "[", "]", "vector", ")", "{", "IStringBuffer", "sb", "=", "new", "IStringBuffer", "(", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ...
vector to json string @param vector @return String
[ "vector", "to", "json", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java#L80-L121
55,717
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java
JSONWriter.map2JsonString
@SuppressWarnings("unchecked") public static String map2JsonString(Map<String, Object> map) { IStringBuffer sb = new IStringBuffer(); sb.append('{'); for ( Map.Entry<String, Object> entry : map.entrySet() ) { sb.append('"').append(entry.getKey().toString()).append("\"...
java
@SuppressWarnings("unchecked") public static String map2JsonString(Map<String, Object> map) { IStringBuffer sb = new IStringBuffer(); sb.append('{'); for ( Map.Entry<String, Object> entry : map.entrySet() ) { sb.append('"').append(entry.getKey().toString()).append("\"...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "String", "map2JsonString", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "IStringBuffer", "sb", "=", "new", "IStringBuffer", "(", ")", ";", "sb", ".", "append", "(",...
map to json string @param map @return String
[ "map", "to", "json", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/core/JSONWriter.java#L176-L217
55,718
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/XML.java
XML.stringToValue
public static Object stringToValue(String string) { if ("true".equalsIgnoreCase(string)) { return Boolean.TRUE; } if ("false".equalsIgnoreCase(string)) { return Boolean.FALSE; } if ("null".equalsIgnoreCase(string)) { return JSONObject.NULL; ...
java
public static Object stringToValue(String string) { if ("true".equalsIgnoreCase(string)) { return Boolean.TRUE; } if ("false".equalsIgnoreCase(string)) { return Boolean.FALSE; } if ("null".equalsIgnoreCase(string)) { return JSONObject.NULL; ...
[ "public", "static", "Object", "stringToValue", "(", "String", "string", ")", "{", "if", "(", "\"true\"", ".", "equalsIgnoreCase", "(", "string", ")", ")", "{", "return", "Boolean", ".", "TRUE", ";", "}", "if", "(", "\"false\"", ".", "equalsIgnoreCase", "("...
Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string. This is much less ambitious than JSONObject.stringToValue, especially because it does not attempt to convert plus forms, octal forms, hex forms, or E forms lacking decimal points. @param string A String. @retur...
[ "Try", "to", "convert", "a", "string", "into", "a", "number", "boolean", "or", "null", ".", "If", "the", "string", "can", "t", "be", "converted", "return", "the", "string", ".", "This", "is", "much", "less", "ambitious", "than", "JSONObject", ".", "strin...
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/XML.java#L302-L334
55,719
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/BitInputStream.java
BitInputStream.pad
public boolean pad(int width) throws IOException { boolean result = true; int gap = (int)this.nrBits % width; if (gap < 0) { gap += width; } if (gap != 0) { int padding = width - gap; while (padding > 0) { if (bit()) { ...
java
public boolean pad(int width) throws IOException { boolean result = true; int gap = (int)this.nrBits % width; if (gap < 0) { gap += width; } if (gap != 0) { int padding = width - gap; while (padding > 0) { if (bit()) { ...
[ "public", "boolean", "pad", "(", "int", "width", ")", "throws", "IOException", "{", "boolean", "result", "=", "true", ";", "int", "gap", "=", "(", "int", ")", "this", ".", "nrBits", "%", "width", ";", "if", "(", "gap", "<", "0", ")", "{", "gap", ...
Check that the rest of the block has been padded with zeroes. @param width The size of the block to pad in bits. This will typically be 8, 16, 32, 64, 128, 256, etc. @return true if the block was zero padded, or false if the the padding contains any one bits. @throws IOException
[ "Check", "that", "the", "rest", "of", "the", "block", "has", "been", "padded", "with", "zeroes", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/BitInputStream.java#L99-L115
55,720
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/BitInputStream.java
BitInputStream.read
public int read(int width) throws IOException { if (width == 0) { return 0; } if (width < 0 || width > 32) { throw new IOException("Bad read width."); } int result = 0; while (width > 0) { if (this.available == 0) { this...
java
public int read(int width) throws IOException { if (width == 0) { return 0; } if (width < 0 || width > 32) { throw new IOException("Bad read width."); } int result = 0; while (width > 0) { if (this.available == 0) { this...
[ "public", "int", "read", "(", "int", "width", ")", "throws", "IOException", "{", "if", "(", "width", "==", "0", ")", "{", "return", "0", ";", "}", "if", "(", "width", "<", "0", "||", "width", ">", "32", ")", "{", "throw", "new", "IOException", "(...
Read some bits. @param width The number of bits to read. (0..32) @throws IOException @return the bits
[ "Read", "some", "bits", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/BitInputStream.java#L125-L152
55,721
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/IPushbackReader.java
IPushbackReader.read
public int read( char[] cbuf, int off, int len ) throws IOException { //check the buffer queue int size = queue.size(); if ( size > 0 ) { //TODO //int num = size <= len ? size : len; //System.arraycopy(src, srcPos, dest, destPos, length) throw ...
java
public int read( char[] cbuf, int off, int len ) throws IOException { //check the buffer queue int size = queue.size(); if ( size > 0 ) { //TODO //int num = size <= len ? size : len; //System.arraycopy(src, srcPos, dest, destPos, length) throw ...
[ "public", "int", "read", "(", "char", "[", "]", "cbuf", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "//check the buffer queue", "int", "size", "=", "queue", ".", "size", "(", ")", ";", "if", "(", "size", ">", "0", ")", ...
read the specified block from the stream @see #read() @return int @throws IOException
[ "read", "the", "specified", "block", "from", "the", "stream" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/IPushbackReader.java#L51-L63
55,722
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/IPushbackReader.java
IPushbackReader.unread
public void unread( char[] cbuf, int off, int len ) { for ( int i = 0; i < len; i++ ) { queue.enQueue(cbuf[off+i]); } }
java
public void unread( char[] cbuf, int off, int len ) { for ( int i = 0; i < len; i++ ) { queue.enQueue(cbuf[off+i]); } }
[ "public", "void", "unread", "(", "char", "[", "]", "cbuf", ",", "int", "off", ",", "int", "len", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "queue", ".", "enQueue", "(", "cbuf", "[", "off", "...
unread a block from a char array to the stream @see #unread(int)
[ "unread", "a", "block", "from", "a", "char", "array", "to", "the", "stream" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/IPushbackReader.java#L89-L94
55,723
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.load
public void load( File file ) throws NumberFormatException, FileNotFoundException, IOException { loadWords(config, this, file, synBuffer); }
java
public void load( File file ) throws NumberFormatException, FileNotFoundException, IOException { loadWords(config, this, file, synBuffer); }
[ "public", "void", "load", "(", "File", "file", ")", "throws", "NumberFormatException", ",", "FileNotFoundException", ",", "IOException", "{", "loadWords", "(", "config", ",", "this", ",", "file", ",", "synBuffer", ")", ";", "}" ]
load all the words from a specified lexicon file @param file @throws IOException @throws FileNotFoundException @throws NumberFormatException
[ "load", "all", "the", "words", "from", "a", "specified", "lexicon", "file" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L73-L77
55,724
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.loadDirectory
public void loadDirectory( String lexDir ) throws IOException { File path = new File(lexDir); if ( ! path.exists() ) { throw new IOException("Lexicon directory ["+lexDir+"] does'n exists."); } /* * load all the lexicon file under the lexicon path ...
java
public void loadDirectory( String lexDir ) throws IOException { File path = new File(lexDir); if ( ! path.exists() ) { throw new IOException("Lexicon directory ["+lexDir+"] does'n exists."); } /* * load all the lexicon file under the lexicon path ...
[ "public", "void", "loadDirectory", "(", "String", "lexDir", ")", "throws", "IOException", "{", "File", "path", "=", "new", "File", "(", "lexDir", ")", ";", "if", "(", "!", "path", ".", "exists", "(", ")", ")", "{", "throw", "new", "IOException", "(", ...
load the all the words from all the files under a specified lexicon directory @param lexDir @throws IOException
[ "load", "the", "all", "the", "words", "from", "all", "the", "files", "under", "a", "specified", "lexicon", "directory" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L111-L132
55,725
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.loadClassPath
public void loadClassPath() throws IOException { Class<?> dClass = this.getClass(); CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource(); if ( codeSrc == null ) { return; } String codePath = codeSrc.getLocation().getPath(); ...
java
public void loadClassPath() throws IOException { Class<?> dClass = this.getClass(); CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource(); if ( codeSrc == null ) { return; } String codePath = codeSrc.getLocation().getPath(); ...
[ "public", "void", "loadClassPath", "(", ")", "throws", "IOException", "{", "Class", "<", "?", ">", "dClass", "=", "this", ".", "getClass", "(", ")", ";", "CodeSource", "codeSrc", "=", "this", ".", "getClass", "(", ")", ".", "getProtectionDomain", "(", ")...
load all the words from all the files under the specified class path. added at 2016/07/12: only in the jar file could the ZipInputStream available add IDE classpath supported here @since 1.9.9 @throws IOException
[ "load", "all", "the", "words", "from", "all", "the", "files", "under", "the", "specified", "class", "path", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L144-L172
55,726
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.startAutoload
public void startAutoload() { if ( autoloadThread != null || config.getLexiconPath() == null ) { return; } //create and start the lexicon auto load thread autoloadThread = new Thread(new Runnable() { @Override public void...
java
public void startAutoload() { if ( autoloadThread != null || config.getLexiconPath() == null ) { return; } //create and start the lexicon auto load thread autoloadThread = new Thread(new Runnable() { @Override public void...
[ "public", "void", "startAutoload", "(", ")", "{", "if", "(", "autoloadThread", "!=", "null", "||", "config", ".", "getLexiconPath", "(", ")", "==", "null", ")", "{", "return", ";", "}", "//create and start the lexicon auto load thread", "autoloadThread", "=", "n...
start the lexicon autoload thread
[ "start", "the", "lexicon", "autoload", "thread" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L251-L326
55,727
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.getIndex
public static int getIndex( String key ) { if ( key == null ) { return -1; } key = key.toUpperCase(); if ( key.startsWith("CJK_WORD") ) { return ILexicon.CJK_WORD; } else if ( key.startsWith("CJK_CHAR") ) { return ILexicon.CJK_CHAR...
java
public static int getIndex( String key ) { if ( key == null ) { return -1; } key = key.toUpperCase(); if ( key.startsWith("CJK_WORD") ) { return ILexicon.CJK_WORD; } else if ( key.startsWith("CJK_CHAR") ) { return ILexicon.CJK_CHAR...
[ "public", "static", "int", "getIndex", "(", "String", "key", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "-", "1", ";", "}", "key", "=", "key", ".", "toUpperCase", "(", ")", ";", "if", "(", "key", ".", "startsWith", "(", "\"CJK_...
get the key's type index located in ILexicon interface @param key @return int
[ "get", "the", "key", "s", "type", "index", "located", "in", "ILexicon", "interface" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L434-L468
55,728
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.loadWords
public static void loadWords( JcsegTaskConfig config, ADictionary dic, File file, List<String[]> buffer ) throws NumberFormatException, FileNotFoundException, IOException { loadWords(config, dic, new FileInputStream(file), buffer); }
java
public static void loadWords( JcsegTaskConfig config, ADictionary dic, File file, List<String[]> buffer ) throws NumberFormatException, FileNotFoundException, IOException { loadWords(config, dic, new FileInputStream(file), buffer); }
[ "public", "static", "void", "loadWords", "(", "JcsegTaskConfig", "config", ",", "ADictionary", "dic", ",", "File", "file", ",", "List", "<", "String", "[", "]", ">", "buffer", ")", "throws", "NumberFormatException", ",", "FileNotFoundException", ",", "IOExceptio...
load all the words in the specified lexicon file into the dictionary @param config @param dic @param file @param buffer @throws IOException @throws FileNotFoundException @throws NumberFormatException
[ "load", "all", "the", "words", "in", "the", "specified", "lexicon", "file", "into", "the", "dictionary" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L491-L496
55,729
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegKit.java
SegKit.appendSynonyms
public final static void appendSynonyms(LinkedList<IWord> wordPool, IWord wd) { List<IWord> synList = wd.getSyn().getList(); synchronized (synList) { for ( int j = 0; j < synList.size(); j++ ) { IWord curWord = synList.get(j); if ( curWord.getValue() ...
java
public final static void appendSynonyms(LinkedList<IWord> wordPool, IWord wd) { List<IWord> synList = wd.getSyn().getList(); synchronized (synList) { for ( int j = 0; j < synList.size(); j++ ) { IWord curWord = synList.get(j); if ( curWord.getValue() ...
[ "public", "final", "static", "void", "appendSynonyms", "(", "LinkedList", "<", "IWord", ">", "wordPool", ",", "IWord", "wd", ")", "{", "List", "<", "IWord", ">", "synList", "=", "wd", ".", "getSyn", "(", ")", ".", "getList", "(", ")", ";", "synchronize...
quick interface to do the synonyms append word You got check if the specified has any synonyms first @param wordPool @param wd
[ "quick", "interface", "to", "do", "the", "synonyms", "append", "word", "You", "got", "check", "if", "the", "specified", "has", "any", "synonyms", "first" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegKit.java#L20-L36
55,730
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java
LRUCache.get
public T get( E key ) { Entry<E, T> entry = null; synchronized(this) { entry = map.get(key); if (map.get(key) == null) return null; entry.prev.next = entry.next; entry.next.prev = entry.prev; entry.prev...
java
public T get( E key ) { Entry<E, T> entry = null; synchronized(this) { entry = map.get(key); if (map.get(key) == null) return null; entry.prev.next = entry.next; entry.next.prev = entry.prev; entry.prev...
[ "public", "T", "get", "(", "E", "key", ")", "{", "Entry", "<", "E", ",", "T", ">", "entry", "=", "null", ";", "synchronized", "(", "this", ")", "{", "entry", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "map", ".", "get", "(", "...
get a element from map with specified key @param key @return value
[ "get", "a", "element", "from", "map", "with", "specified", "key" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java#L67-L85
55,731
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java
LRUCache.set
public void set(E key, T value) { Entry<E, T> entry = new Entry<E, T>(key, value, null, null); synchronized(this) { if (map.get(key) == null) { if (this.length >= this.capacity) this.removeLeastUsedElements(); ...
java
public void set(E key, T value) { Entry<E, T> entry = new Entry<E, T>(key, value, null, null); synchronized(this) { if (map.get(key) == null) { if (this.length >= this.capacity) this.removeLeastUsedElements(); ...
[ "public", "void", "set", "(", "E", "key", ",", "T", "value", ")", "{", "Entry", "<", "E", ",", "T", ">", "entry", "=", "new", "Entry", "<", "E", ",", "T", ">", "(", "key", ",", "value", ",", "null", ",", "null", ")", ";", "synchronized", "(",...
set a element to list @param key @param value
[ "set", "a", "element", "to", "list" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java#L93-L124
55,732
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java
LRUCache.remove
public synchronized void remove(E key) { Entry<E, T> entry = map.get(key); this.tail.prev = entry.prev; entry.prev.next = this.tail; map.remove(entry.key); this.length--; }
java
public synchronized void remove(E key) { Entry<E, T> entry = map.get(key); this.tail.prev = entry.prev; entry.prev.next = this.tail; map.remove(entry.key); this.length--; }
[ "public", "synchronized", "void", "remove", "(", "E", "key", ")", "{", "Entry", "<", "E", ",", "T", ">", "entry", "=", "map", ".", "get", "(", "key", ")", ";", "this", ".", "tail", ".", "prev", "=", "entry", ".", "prev", ";", "entry", ".", "pre...
remove a element from list @param key
[ "remove", "a", "element", "from", "list" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java#L132-L139
55,733
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java
LRUCache.removeLeastUsedElements
public synchronized void removeLeastUsedElements() { int rows = this.removePercent / 100 * this.length; rows = rows == 0 ? 1 : rows; while(rows > 0 && this.length > 0) { // remove the last element Entry<E, T> entry = this.tail.prev; ...
java
public synchronized void removeLeastUsedElements() { int rows = this.removePercent / 100 * this.length; rows = rows == 0 ? 1 : rows; while(rows > 0 && this.length > 0) { // remove the last element Entry<E, T> entry = this.tail.prev; ...
[ "public", "synchronized", "void", "removeLeastUsedElements", "(", ")", "{", "int", "rows", "=", "this", ".", "removePercent", "/", "100", "*", "this", ".", "length", ";", "rows", "=", "rows", "==", "0", "?", "1", ":", "rows", ";", "while", "(", "rows",...
remove least used elements
[ "remove", "least", "used", "elements" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java#L142-L157
55,734
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java
LRUCache.printList
public synchronized void printList(){ Entry<E, T> entry = this.head.next; System.out.println("\n|----- key list----|"); while( entry != this.tail) { System.out.println(" -> " + entry.key ); entry = entry.next; } System.out.println("|------...
java
public synchronized void printList(){ Entry<E, T> entry = this.head.next; System.out.println("\n|----- key list----|"); while( entry != this.tail) { System.out.println(" -> " + entry.key ); entry = entry.next; } System.out.println("|------...
[ "public", "synchronized", "void", "printList", "(", ")", "{", "Entry", "<", "E", ",", "T", ">", "entry", "=", "this", ".", "head", ".", "next", ";", "System", ".", "out", ".", "println", "(", "\"\\n|----- key list----|\"", ")", ";", "while", "(", "entr...
print the list NOTE: for test only
[ "print", "the", "list" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/util/LRUCache.java#L173-L183
55,735
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/BitOutputStream.java
BitOutputStream.write
public void write(int bits, int width) throws IOException { if (bits == 0 && width == 0) { return; } if (width <= 0 || width > 32) { throw new IOException("Bad write width."); } while (width > 0) { int actual = width; if (actual > t...
java
public void write(int bits, int width) throws IOException { if (bits == 0 && width == 0) { return; } if (width <= 0 || width > 32) { throw new IOException("Bad write width."); } while (width > 0) { int actual = width; if (actual > t...
[ "public", "void", "write", "(", "int", "bits", ",", "int", "width", ")", "throws", "IOException", "{", "if", "(", "bits", "==", "0", "&&", "width", "==", "0", ")", "{", "return", ";", "}", "if", "(", "width", "<=", "0", "||", "width", ">", "32", ...
Write some bits. Up to 32 bits can be written at a time. @param bits The bits to be written. @param width The number of bits to write. (0..32) @throws IOException
[ "Write", "some", "bits", ".", "Up", "to", "32", "bits", "can", "be", "written", "at", "a", "time", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/BitOutputStream.java#L120-L143
55,736
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/Word.java
Word.__toString
public String __toString() { StringBuilder sb = new StringBuilder(); sb.append(value); sb.append('/'); //append the cx if ( partspeech != null ) { for ( int j = 0; j < partspeech.length; j++ ) { if ( j == 0 ) { sb.append(partsp...
java
public String __toString() { StringBuilder sb = new StringBuilder(); sb.append(value); sb.append('/'); //append the cx if ( partspeech != null ) { for ( int j = 0; j < partspeech.length; j++ ) { if ( j == 0 ) { sb.append(partsp...
[ "public", "String", "__toString", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "value", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "//append the cx", "if", "(", "partspeech", ...
for debug only
[ "for", "debug", "only" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/Word.java#L323-L378
55,737
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.insertionSort
public static <T extends Comparable<? super T>> void insertionSort( T[] arr ) { int j; for ( int i = 1; i < arr.length; i++ ) { T tmp = arr[i]; for ( j = i; j > 0 && tmp.compareTo(arr[j-1]) < 0; j--) { arr[j] = arr[j-1]; } ...
java
public static <T extends Comparable<? super T>> void insertionSort( T[] arr ) { int j; for ( int i = 1; i < arr.length; i++ ) { T tmp = arr[i]; for ( j = i; j > 0 && tmp.compareTo(arr[j-1]) < 0; j--) { arr[j] = arr[j-1]; } ...
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "insertionSort", "(", "T", "[", "]", "arr", ")", "{", "int", "j", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "arr", ".", "length", ";", ...
insert sort method @param arr an array of a comparable items
[ "insert", "sort", "method" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L46-L57
55,738
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.shellSort
public static <T extends Comparable<? super T>> void shellSort( T[] arr ) { int j, k = 0, gap; for ( ; GAPS[k] < arr.length; k++ ) ; while ( k-- > 0 ) { gap = GAPS[k]; for ( int i = gap; i < arr.length; i++ ) { T tmp = arr[ i ]; ...
java
public static <T extends Comparable<? super T>> void shellSort( T[] arr ) { int j, k = 0, gap; for ( ; GAPS[k] < arr.length; k++ ) ; while ( k-- > 0 ) { gap = GAPS[k]; for ( int i = gap; i < arr.length; i++ ) { T tmp = arr[ i ]; ...
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "shellSort", "(", "T", "[", "]", "arr", ")", "{", "int", "j", ",", "k", "=", "0", ",", "gap", ";", "for", "(", ";", "GAPS", "[", "k", "]", "<", ...
shell sort algorithm @param arr an array of Comparable items
[ "shell", "sort", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L64-L80
55,739
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.mergeSort
@SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> void mergeSort( T[] arr ) { /*if ( arr.length < 15 ) { insertionSort( arr ); return; }*/ T[] tmpArr = (T[]) new Comparable[arr.length]; mergeSort(arr, tmpArr, ...
java
@SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> void mergeSort( T[] arr ) { /*if ( arr.length < 15 ) { insertionSort( arr ); return; }*/ T[] tmpArr = (T[]) new Comparable[arr.length]; mergeSort(arr, tmpArr, ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "mergeSort", "(", "T", "[", "]", "arr", ")", "{", "/*if ( arr.length < 15 ) {\n insertionSort( arr );\n ...
merge sort algorithm @param arr an array of Comparable item
[ "merge", "sort", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L90-L101
55,740
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.mergeSort
private static <T extends Comparable<? super T>> void mergeSort( T[] arr, T[] tmpArr, int left, int right ) { //recursive way if ( left < right ) { int center = ( left + right ) / 2; mergeSort(arr, tmpArr, left, center); mergeSort(arr, tmpArr, center + 1, rig...
java
private static <T extends Comparable<? super T>> void mergeSort( T[] arr, T[] tmpArr, int left, int right ) { //recursive way if ( left < right ) { int center = ( left + right ) / 2; mergeSort(arr, tmpArr, left, center); mergeSort(arr, tmpArr, center + 1, rig...
[ "private", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "mergeSort", "(", "T", "[", "]", "arr", ",", "T", "[", "]", "tmpArr", ",", "int", "left", ",", "int", "right", ")", "{", "//recursive way", "if", "(",...
internal method to make a recursive call @param arr an array of Comparable items @param tmpArr temp array to placed the merged result @param left left-most index of the subarray @param right right-most index of the subarray
[ "internal", "method", "to", "make", "a", "recursive", "call" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L111-L142
55,741
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.merge
private static <T extends Comparable<? super T>> void merge( T[] arr, T[] tmpArr, int lPos, int rPos, int rEnd ) { int lEnd = rPos - 1; int tPos = lPos; int leftTmp = lPos; while ( lPos <= lEnd && rPos <= rEnd ) { if ( arr[lPos].compareTo( arr[rPos] ) <= 0 )...
java
private static <T extends Comparable<? super T>> void merge( T[] arr, T[] tmpArr, int lPos, int rPos, int rEnd ) { int lEnd = rPos - 1; int tPos = lPos; int leftTmp = lPos; while ( lPos <= lEnd && rPos <= rEnd ) { if ( arr[lPos].compareTo( arr[rPos] ) <= 0 )...
[ "private", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "merge", "(", "T", "[", "]", "arr", ",", "T", "[", "]", "tmpArr", ",", "int", "lPos", ",", "int", "rPos", ",", "int", "rEnd", ")", "{", "int", "lE...
internal method to merge the sorted halves of a subarray @param arr an array of Comparable items @param tmpArr temp array to placed the merged result @param leftPos left-most index of the subarray @param rightPos right start index of the subarray @param endPos right-most index of the subarray
[ "internal", "method", "to", "merge", "the", "sorted", "halves", "of", "a", "subarray" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L153-L182
55,742
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.swapReferences
private static <T> void swapReferences( T[] arr, int idx1, int idx2 ) { T tmp = arr[idx1]; arr[idx1] = arr[idx2]; arr[idx2] = tmp; }
java
private static <T> void swapReferences( T[] arr, int idx1, int idx2 ) { T tmp = arr[idx1]; arr[idx1] = arr[idx2]; arr[idx2] = tmp; }
[ "private", "static", "<", "T", ">", "void", "swapReferences", "(", "T", "[", "]", "arr", ",", "int", "idx1", ",", "int", "idx2", ")", "{", "T", "tmp", "=", "arr", "[", "idx1", "]", ";", "arr", "[", "idx1", "]", "=", "arr", "[", "idx2", "]", "...
method to swap elements in an array @param arr an array of Objects @param idx1 the index of the first element @param idx2 the index of the second element
[ "method", "to", "swap", "elements", "in", "an", "array" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L194-L199
55,743
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.quicksort
public static <T extends Comparable<? super T>> void quicksort( T[] arr ) { quicksort( arr, 0, arr.length - 1 ); }
java
public static <T extends Comparable<? super T>> void quicksort( T[] arr ) { quicksort( arr, 0, arr.length - 1 ); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "quicksort", "(", "T", "[", "]", "arr", ")", "{", "quicksort", "(", "arr", ",", "0", ",", "arr", ".", "length", "-", "1", ")", ";", "}" ]
quick sort algorithm @param arr an array of Comparable items
[ "quick", "sort", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L207-L210
55,744
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.insertionSort
public static <T extends Comparable<? super T>> void insertionSort( T[] arr, int start, int end ) { int i; for ( int j = start + 1; j <= end; j++ ) { T tmp = arr[j]; for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) { arr[ i ] = arr[ i - 1 ...
java
public static <T extends Comparable<? super T>> void insertionSort( T[] arr, int start, int end ) { int i; for ( int j = start + 1; j <= end; j++ ) { T tmp = arr[j]; for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) { arr[ i ] = arr[ i - 1 ...
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "insertionSort", "(", "T", "[", "]", "arr", ",", "int", "start", ",", "int", "end", ")", "{", "int", "i", ";", "for", "(", "int", "j", "=", "start", ...
method to sort an subarray from start to end with insertion sort algorithm @param arr an array of Comparable items @param start the begining position @param end the end position
[ "method", "to", "sort", "an", "subarray", "from", "start", "to", "end", "with", "insertion", "sort", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L246-L257
55,745
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.quicksort
private static <T extends Comparable<? super T>> void quicksort( T[] arr, int left, int right ) { if ( left + CUTOFF <= right ) { //find the pivot T pivot = median( arr, left, right ); //start partitioning int i = left, j = right - 1; ...
java
private static <T extends Comparable<? super T>> void quicksort( T[] arr, int left, int right ) { if ( left + CUTOFF <= right ) { //find the pivot T pivot = median( arr, left, right ); //start partitioning int i = left, j = right - 1; ...
[ "private", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "quicksort", "(", "T", "[", "]", "arr", ",", "int", "left", ",", "int", "right", ")", "{", "if", "(", "left", "+", "CUTOFF", "<=", "right", ")", "{"...
internal method to sort the array with quick sort algorithm @param arr an array of Comparable Items @param left the left-most index of the subarray @param right the right-most index of the subarray
[ "internal", "method", "to", "sort", "the", "array", "with", "quick", "sort", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L266-L295
55,746
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.quickSelect
public static <T extends Comparable<? super T>> void quickSelect( T[] arr, int k ) { quickSelect( arr, 0, arr.length - 1, k ); }
java
public static <T extends Comparable<? super T>> void quickSelect( T[] arr, int k ) { quickSelect( arr, 0, arr.length - 1, k ); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "quickSelect", "(", "T", "[", "]", "arr", ",", "int", "k", ")", "{", "quickSelect", "(", "arr", ",", "0", ",", "arr", ".", "length", "-", "1", ",", ...
quick select algorithm @param arr an array of Comparable items @param k the k-th small index
[ "quick", "select", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L306-L310
55,747
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.bucketSort
public static void bucketSort( int[] arr, int m ) { int[] count = new int[m]; int j, i = 0; //System.out.println(count[0]==0?"true":"false"); for ( j = 0; j < arr.length; j++ ) { count[ arr[j] ]++; } //loop and filter the elements for ( j ...
java
public static void bucketSort( int[] arr, int m ) { int[] count = new int[m]; int j, i = 0; //System.out.println(count[0]==0?"true":"false"); for ( j = 0; j < arr.length; j++ ) { count[ arr[j] ]++; } //loop and filter the elements for ( j ...
[ "public", "static", "void", "bucketSort", "(", "int", "[", "]", "arr", ",", "int", "m", ")", "{", "int", "[", "]", "count", "=", "new", "int", "[", "m", "]", ";", "int", "j", ",", "i", "=", "0", ";", "//System.out.println(count[0]==0?\"true\":\"false\"...
bucket sort algorithm @param arr an int array @param m the large-most one for all the Integers in arr
[ "bucket", "sort", "algorithm" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L356-L373
55,748
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Util.java
Util.getJarHome
public static String getJarHome(Object o) { String path = o.getClass().getProtectionDomain() .getCodeSource().getLocation().getFile(); File jarFile = new File(path); return jarFile.getParentFile().getAbsolutePath(); }
java
public static String getJarHome(Object o) { String path = o.getClass().getProtectionDomain() .getCodeSource().getLocation().getFile(); File jarFile = new File(path); return jarFile.getParentFile().getAbsolutePath(); }
[ "public", "static", "String", "getJarHome", "(", "Object", "o", ")", "{", "String", "path", "=", "o", ".", "getClass", "(", ")", ".", "getProtectionDomain", "(", ")", ".", "getCodeSource", "(", ")", ".", "getLocation", "(", ")", ".", "getFile", "(", ")...
get the absolute parent path for the jar file. @param o @return String
[ "get", "the", "absolute", "parent", "path", "for", "the", "jar", "file", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Util.java#L19-L25
55,749
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Util.java
Util.printMatrix
public static void printMatrix(double[][] matrix) { StringBuffer sb = new StringBuffer(); sb.append('[').append('\n'); for ( double[] line : matrix ) { for ( double column : line ) { sb.append(column).append(", "); } sb.append('\n'); ...
java
public static void printMatrix(double[][] matrix) { StringBuffer sb = new StringBuffer(); sb.append('[').append('\n'); for ( double[] line : matrix ) { for ( double column : line ) { sb.append(column).append(", "); } sb.append('\n'); ...
[ "public", "static", "void", "printMatrix", "(", "double", "[", "]", "[", "]", "matrix", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "f...
print the specified matrix @param matrix
[ "print", "the", "specified", "matrix" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Util.java#L32-L44
55,750
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServerConfig.java
JcsegServerConfig.resetFromFile
public void resetFromFile(String configFile) throws IOException { IStringBuffer isb = new IStringBuffer(); String line = null; BufferedReader reader = new BufferedReader(new FileReader(configFile)); while ( (line = reader.readLine()) != null ) { line = line.trim(); ...
java
public void resetFromFile(String configFile) throws IOException { IStringBuffer isb = new IStringBuffer(); String line = null; BufferedReader reader = new BufferedReader(new FileReader(configFile)); while ( (line = reader.readLine()) != null ) { line = line.trim(); ...
[ "public", "void", "resetFromFile", "(", "String", "configFile", ")", "throws", "IOException", "{", "IStringBuffer", "isb", "=", "new", "IStringBuffer", "(", ")", ";", "String", "line", "=", "null", ";", "BufferedReader", "reader", "=", "new", "BufferedReader", ...
initialize it from the specified config file @param configFile @throws IOException
[ "initialize", "it", "from", "the", "specified", "config", "file" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServerConfig.java#L47-L67
55,751
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/IIntFIFO.java
IIntFIFO.enQueue
public boolean enQueue( int data ) { Entry o = new Entry(data, head.next); head.next = o; size++; return true; }
java
public boolean enQueue( int data ) { Entry o = new Entry(data, head.next); head.next = o; size++; return true; }
[ "public", "boolean", "enQueue", "(", "int", "data", ")", "{", "Entry", "o", "=", "new", "Entry", "(", "data", ",", "head", ".", "next", ")", ";", "head", ".", "next", "=", "o", ";", "size", "++", ";", "return", "true", ";", "}" ]
add a new item to the queue @param data @return boolean
[ "add", "a", "new", "item", "to", "the", "queue" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/IIntFIFO.java#L28-L35
55,752
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java
DictionaryFactory.createDictionary
public static ADictionary createDictionary( Class<? extends ADictionary> _class, Class<?>[] paramType, Object[] args) { try { Constructor<?> cons = _class.getConstructor(paramType); return ( ( ADictionary ) cons.newInstance(args) ); } catch ( Exception e ) { ...
java
public static ADictionary createDictionary( Class<? extends ADictionary> _class, Class<?>[] paramType, Object[] args) { try { Constructor<?> cons = _class.getConstructor(paramType); return ( ( ADictionary ) cons.newInstance(args) ); } catch ( Exception e ) { ...
[ "public", "static", "ADictionary", "createDictionary", "(", "Class", "<", "?", "extends", "ADictionary", ">", "_class", ",", "Class", "<", "?", ">", "[", "]", "paramType", ",", "Object", "[", "]", "args", ")", "{", "try", "{", "Constructor", "<", "?", ...
create a new ADictionary instance @param _class @return ADictionary
[ "create", "a", "new", "ADictionary", "instance" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java#L37-L50
55,753
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java
DictionaryFactory.createDefaultDictionary
public static ADictionary createDefaultDictionary(JcsegTaskConfig config, boolean loadDic) { return createDefaultDictionary(config, config.isAutoload(), loadDic); }
java
public static ADictionary createDefaultDictionary(JcsegTaskConfig config, boolean loadDic) { return createDefaultDictionary(config, config.isAutoload(), loadDic); }
[ "public", "static", "ADictionary", "createDefaultDictionary", "(", "JcsegTaskConfig", "config", ",", "boolean", "loadDic", ")", "{", "return", "createDefaultDictionary", "(", "config", ",", "config", ".", "isAutoload", "(", ")", ",", "loadDic", ")", ";", "}" ]
create the ADictionary according to the JcsegTaskConfig @param config @param loadDic @return ADictionary
[ "create", "the", "ADictionary", "according", "to", "the", "JcsegTaskConfig" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java#L123-L126
55,754
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java
DictionaryFactory.createSingletonDictionary
public static ADictionary createSingletonDictionary(JcsegTaskConfig config, boolean loadDic) { synchronized (LOCK) { if ( singletonDic == null ) { singletonDic = createDefaultDictionary(config, loadDic); } } return singletonDic; }
java
public static ADictionary createSingletonDictionary(JcsegTaskConfig config, boolean loadDic) { synchronized (LOCK) { if ( singletonDic == null ) { singletonDic = createDefaultDictionary(config, loadDic); } } return singletonDic; }
[ "public", "static", "ADictionary", "createSingletonDictionary", "(", "JcsegTaskConfig", "config", ",", "boolean", "loadDic", ")", "{", "synchronized", "(", "LOCK", ")", "{", "if", "(", "singletonDic", "==", "null", ")", "{", "singletonDic", "=", "createDefaultDict...
create a singleton ADictionary object according to the JcsegTaskConfig @param config @param loadDic @return ADictionary
[ "create", "a", "singleton", "ADictionary", "object", "according", "to", "the", "JcsegTaskConfig" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java#L147-L156
55,755
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/STConverter.java
STConverter.TraToSimplified
public static String TraToSimplified( String str ) { StringBuffer sb = new StringBuffer(); int idx; for ( int j = 0; j < str.length(); j++ ) { if ( (idx = TRASTR.indexOf(str.charAt(j))) != -1 ) { sb.append(SIMSTR.charAt(idx)); } else { ...
java
public static String TraToSimplified( String str ) { StringBuffer sb = new StringBuffer(); int idx; for ( int j = 0; j < str.length(); j++ ) { if ( (idx = TRASTR.indexOf(str.charAt(j))) != -1 ) { sb.append(SIMSTR.charAt(idx)); } else { ...
[ "public", "static", "String", "TraToSimplified", "(", "String", "str", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "int", "idx", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "str", ".", "length", "(", ")", ";...
convert the traditional words to simplified words of the specified string. @param str @return String
[ "convert", "the", "traditional", "words", "to", "simplified", "words", "of", "the", "specified", "string", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/STConverter.java#L62-L74
55,756
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java
SegmentFactory.createSegment
public static ISegment createSegment( Class<? extends ISegment> _class, Class<?> paramtypes[], Object args[] ) { ISegment seg = null; try { Constructor<?> cons = _class.getConstructor(paramtypes); seg = (ISegment) cons.newInstance(args); } catch (Exce...
java
public static ISegment createSegment( Class<? extends ISegment> _class, Class<?> paramtypes[], Object args[] ) { ISegment seg = null; try { Constructor<?> cons = _class.getConstructor(paramtypes); seg = (ISegment) cons.newInstance(args); } catch (Exce...
[ "public", "static", "ISegment", "createSegment", "(", "Class", "<", "?", "extends", "ISegment", ">", "_class", ",", "Class", "<", "?", ">", "paramtypes", "[", "]", ",", "Object", "args", "[", "]", ")", "{", "ISegment", "seg", "=", "null", ";", "try", ...
load the ISegment class with the given path @param _class @return ISegment
[ "load", "the", "ISegment", "class", "with", "the", "given", "path" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java#L32-L46
55,757
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java
SegmentFactory.createJcseg
public static ISegment createJcseg( int mode, Object...args ) throws JcsegException { Class<? extends ISegment> _clsname; switch ( mode ) { case JcsegTaskConfig.SIMPLE_MODE: _clsname = SimpleSeg.class; break; case JcsegTaskConfig.COMPLEX_MODE: _cl...
java
public static ISegment createJcseg( int mode, Object...args ) throws JcsegException { Class<? extends ISegment> _clsname; switch ( mode ) { case JcsegTaskConfig.SIMPLE_MODE: _clsname = SimpleSeg.class; break; case JcsegTaskConfig.COMPLEX_MODE: _cl...
[ "public", "static", "ISegment", "createJcseg", "(", "int", "mode", ",", "Object", "...", "args", ")", "throws", "JcsegException", "{", "Class", "<", "?", "extends", "ISegment", ">", "_clsname", ";", "switch", "(", "mode", ")", "{", "case", "JcsegTaskConfig",...
create the specified mode Jcseg instance @param mode @return ISegment @throws JcsegException
[ "create", "the", "specified", "mode", "Jcseg", "instance" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java#L55-L91
55,758
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java
JcsegServer.init
private void init() { //setup thread pool QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMaxThreads(config.getMaxThreadPoolSize()); threadPool.setIdleTimeout(config.getThreadIdleTimeout()); server = new Server(threadPool); //setu...
java
private void init() { //setup thread pool QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMaxThreads(config.getMaxThreadPoolSize()); threadPool.setIdleTimeout(config.getThreadIdleTimeout()); server = new Server(threadPool); //setu...
[ "private", "void", "init", "(", ")", "{", "//setup thread pool", "QueuedThreadPool", "threadPool", "=", "new", "QueuedThreadPool", "(", ")", ";", "threadPool", ".", "setMaxThreads", "(", "config", ".", "getMaxThreadPoolSize", "(", ")", ")", ";", "threadPool", "....
initialize the server and register the basic context handler
[ "initialize", "the", "server", "and", "register", "the", "basic", "context", "handler" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java#L68-L94
55,759
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java
JcsegServer.registerHandler
public JcsegServer registerHandler() { String basePath = this.getClass().getPackage().getName()+".controller"; AbstractRouter router = new DynamicRestRouter(basePath, MainController.class); router.addMapping("/extractor/keywords", KeywordsController.class); router.addMapping("/extrac...
java
public JcsegServer registerHandler() { String basePath = this.getClass().getPackage().getName()+".controller"; AbstractRouter router = new DynamicRestRouter(basePath, MainController.class); router.addMapping("/extractor/keywords", KeywordsController.class); router.addMapping("/extrac...
[ "public", "JcsegServer", "registerHandler", "(", ")", "{", "String", "basePath", "=", "this", ".", "getClass", "(", ")", ".", "getPackage", "(", ")", ".", "getName", "(", ")", "+", "\".controller\"", ";", "AbstractRouter", "router", "=", "new", "DynamicRestR...
register handler service
[ "register", "handler", "service" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java#L99-L135
55,760
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java
JcsegServer.resetJcsegTaskConfig
private void resetJcsegTaskConfig(JcsegTaskConfig config, JSONObject json) { if ( json.has("jcseg_maxlen") ) { config.setMaxLength(json.getInt("jcseg_maxlen")); } if ( json.has("jcseg_icnname") ) { config.setICnName(json.getBoolean("jcseg_icnname")); } ...
java
private void resetJcsegTaskConfig(JcsegTaskConfig config, JSONObject json) { if ( json.has("jcseg_maxlen") ) { config.setMaxLength(json.getInt("jcseg_maxlen")); } if ( json.has("jcseg_icnname") ) { config.setICnName(json.getBoolean("jcseg_icnname")); } ...
[ "private", "void", "resetJcsegTaskConfig", "(", "JcsegTaskConfig", "config", ",", "JSONObject", "json", ")", "{", "if", "(", "json", ".", "has", "(", "\"jcseg_maxlen\"", ")", ")", "{", "config", ".", "setMaxLength", "(", "json", ".", "getInt", "(", "\"jcseg_...
reset a JcsegTaskConfig from a JSONObject @param config @param json
[ "reset", "a", "JcsegTaskConfig", "from", "a", "JSONObject" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/server/JcsegServer.java#L321-L359
55,761
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Keep.java
Keep.compact
private void compact() { int from = 0; int to = 0; while (from < this.capacity) { Object key = this.list[from]; long usage = age(this.ticks[from]); if (usage > 0) { this.ticks[to] = usage; this.list[to] = key; th...
java
private void compact() { int from = 0; int to = 0; while (from < this.capacity) { Object key = this.list[from]; long usage = age(this.ticks[from]); if (usage > 0) { this.ticks[to] = usage; this.list[to] = key; th...
[ "private", "void", "compact", "(", ")", "{", "int", "from", "=", "0", ";", "int", "to", "=", "0", ";", "while", "(", "from", "<", "this", ".", "capacity", ")", "{", "Object", "key", "=", "this", ".", "list", "[", "from", "]", ";", "long", "usag...
Compact the keep. A keep may contain at most this.capacity elements. The keep contents can be reduced by deleting all elements with low use counts, and by reducing the use counts of the survivors.
[ "Compact", "the", "keep", ".", "A", "keep", "may", "contain", "at", "most", "this", ".", "capacity", "elements", ".", "The", "keep", "contents", "can", "be", "reduced", "by", "deleting", "all", "elements", "with", "low", "use", "counts", "and", "by", "re...
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Keep.java#L90-L113
55,762
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Keep.java
Keep.find
public int find(Object key) { Object o = this.map.get(key); return o instanceof Integer ? ((Integer) o).intValue() : none; }
java
public int find(Object key) { Object o = this.map.get(key); return o instanceof Integer ? ((Integer) o).intValue() : none; }
[ "public", "int", "find", "(", "Object", "key", ")", "{", "Object", "o", "=", "this", ".", "map", ".", "get", "(", "key", ")", ";", "return", "o", "instanceof", "Integer", "?", "(", "(", "Integer", ")", "o", ")", ".", "intValue", "(", ")", ":", ...
Find the integer value associated with this key, or nothing if this key is not in the keep. @param key An object. @return An integer
[ "Find", "the", "integer", "value", "associated", "with", "this", "key", "or", "nothing", "if", "this", "key", "is", "not", "in", "the", "keep", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Keep.java#L123-L126
55,763
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Keep.java
Keep.register
public void register(Object value) { if (JSONzip.probe) { int integer = find(value); if (integer >= 0) { JSONzip.log("\nDuplicate key " + value); } } if (this.length >= this.capacity) { compact(); } this.list[this.le...
java
public void register(Object value) { if (JSONzip.probe) { int integer = find(value); if (integer >= 0) { JSONzip.log("\nDuplicate key " + value); } } if (this.length >= this.capacity) { compact(); } this.list[this.le...
[ "public", "void", "register", "(", "Object", "value", ")", "{", "if", "(", "JSONzip", ".", "probe", ")", "{", "int", "integer", "=", "find", "(", "value", ")", ";", "if", "(", "integer", ">=", "0", ")", "{", "JSONzip", ".", "log", "(", "\"\\nDuplic...
Register a value in the keep. Compact the keep if it is full. The next time this value is encountered, its integer can be sent instead. @param value A value.
[ "Register", "a", "value", "in", "the", "keep", ".", "Compact", "the", "keep", "if", "it", "is", "full", ".", "The", "next", "time", "this", "value", "is", "encountered", "its", "integer", "can", "be", "sent", "instead", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Keep.java#L164-L181
55,764
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java
MMSegFilter.getMaximumMatchChunks
public static IChunk[] getMaximumMatchChunks(IChunk[] chunks) { int maxLength = chunks[0].getLength(); int j; //find the maximum word length for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j].getLength() > maxLength ) maxLength = chunks[j].getLength(...
java
public static IChunk[] getMaximumMatchChunks(IChunk[] chunks) { int maxLength = chunks[0].getLength(); int j; //find the maximum word length for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j].getLength() > maxLength ) maxLength = chunks[j].getLength(...
[ "public", "static", "IChunk", "[", "]", "getMaximumMatchChunks", "(", "IChunk", "[", "]", "chunks", ")", "{", "int", "maxLength", "=", "chunks", "[", "0", "]", ".", "getLength", "(", ")", ";", "int", "j", ";", "//find the maximum word length", "for", "(", ...
1. the maximum match rule this rule will return the chunks that own the largest word length
[ "1", ".", "the", "maximum", "match", "rule", "this", "rule", "will", "return", "the", "chunks", "that", "own", "the", "largest", "word", "length" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java#L16-L40
55,765
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java
MMSegFilter.getLargestAverageWordLengthChunks
public static IChunk[] getLargestAverageWordLengthChunks(IChunk[] chunks) { double largetAverage = chunks[0].getAverageWordsLength(); int j; //find the largest average word length for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j].getAverageWordsLength() > l...
java
public static IChunk[] getLargestAverageWordLengthChunks(IChunk[] chunks) { double largetAverage = chunks[0].getAverageWordsLength(); int j; //find the largest average word length for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j].getAverageWordsLength() > l...
[ "public", "static", "IChunk", "[", "]", "getLargestAverageWordLengthChunks", "(", "IChunk", "[", "]", "chunks", ")", "{", "double", "largetAverage", "=", "chunks", "[", "0", "]", ".", "getAverageWordsLength", "(", ")", ";", "int", "j", ";", "//find the largest...
2. largest average word length this rule will return the chunks that own the largest average word length
[ "2", ".", "largest", "average", "word", "length", "this", "rule", "will", "return", "the", "chunks", "that", "own", "the", "largest", "average", "word", "length" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java#L47-L73
55,766
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java
MMSegFilter.getSmallestVarianceWordLengthChunks
public static IChunk[] getSmallestVarianceWordLengthChunks(IChunk[] chunks) { double smallestVariance = chunks[0].getWordsVariance(); int j; //find the smallest variance word length for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j].getWordsVariance() < smal...
java
public static IChunk[] getSmallestVarianceWordLengthChunks(IChunk[] chunks) { double smallestVariance = chunks[0].getWordsVariance(); int j; //find the smallest variance word length for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j].getWordsVariance() < smal...
[ "public", "static", "IChunk", "[", "]", "getSmallestVarianceWordLengthChunks", "(", "IChunk", "[", "]", "chunks", ")", "{", "double", "smallestVariance", "=", "chunks", "[", "0", "]", ".", "getWordsVariance", "(", ")", ";", "int", "j", ";", "//find the smalles...
the smallest variance word length this rule will the chunks that one the smallest variance word length
[ "the", "smallest", "variance", "word", "length", "this", "rule", "will", "the", "chunks", "that", "one", "the", "smallest", "variance", "word", "length" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java#L79-L105
55,767
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java
MMSegFilter.getLargestSingleMorphemicFreedomChunks
public static IChunk[] getLargestSingleMorphemicFreedomChunks(IChunk[] chunks) { double largestFreedom = chunks[0].getSingleWordsMorphemicFreedom(); int j; //find the maximum sum of single morphemic freedom for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j]....
java
public static IChunk[] getLargestSingleMorphemicFreedomChunks(IChunk[] chunks) { double largestFreedom = chunks[0].getSingleWordsMorphemicFreedom(); int j; //find the maximum sum of single morphemic freedom for ( j = 1; j < chunks.length; j++ ) { if ( chunks[j]....
[ "public", "static", "IChunk", "[", "]", "getLargestSingleMorphemicFreedomChunks", "(", "IChunk", "[", "]", "chunks", ")", "{", "double", "largestFreedom", "=", "chunks", "[", "0", "]", ".", "getSingleWordsMorphemicFreedom", "(", ")", ";", "int", "j", ";", "//f...
the largest sum of degree of morphemic freedom of one-character words this rule will return the chunks that own the largest sum of degree of morphemic freedom of one-character
[ "the", "largest", "sum", "of", "degree", "of", "morphemic", "freedom", "of", "one", "-", "character", "words", "this", "rule", "will", "return", "the", "chunks", "that", "own", "the", "largest", "sum", "of", "degree", "of", "morphemic", "freedom", "of", "o...
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/MMSegFilter.java#L113-L139
55,768
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.implode
public static String implode(String glue, Object[] pieces) { if ( pieces == null ) { return null; } StringBuffer sb = new StringBuffer(); for ( Object o : pieces ) { if ( sb.length() > 0 ) { sb.append(glue); } ...
java
public static String implode(String glue, Object[] pieces) { if ( pieces == null ) { return null; } StringBuffer sb = new StringBuffer(); for ( Object o : pieces ) { if ( sb.length() > 0 ) { sb.append(glue); } ...
[ "public", "static", "String", "implode", "(", "String", "glue", ",", "Object", "[", "]", "pieces", ")", "{", "if", "(", "pieces", "==", "null", ")", "{", "return", "null", ";", "}", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "fo...
String array implode internal method @param glue @param pieces @return String
[ "String", "array", "implode", "internal", "method" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L17-L33
55,769
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.indexOf
public static int indexOf(String ele, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].equals(ele) ) { return i; } } return -1; }
java
public static int indexOf(String ele, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].equals(ele) ) { return i; } } return -1; }
[ "public", "static", "int", "indexOf", "(", "String", "ele", ",", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length...
check and search the specified element in the Array @param ele @param arr @return int
[ "check", "and", "search", "the", "specified", "element", "in", "the", "Array" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L42-L55
55,770
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.startsWith
public static int startsWith(String str, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].startsWith(str) ) { return i; } } return -1; }
java
public static int startsWith(String str, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].startsWith(str) ) { return i; } } return -1; }
[ "public", "static", "int", "startsWith", "(", "String", "str", ",", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "len...
check if there is an element that starts with the specified string @param str @return int
[ "check", "if", "there", "is", "an", "element", "that", "starts", "with", "the", "specified", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L63-L76
55,771
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.endsWith
public static int endsWith(String str, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].endsWith(str) ) { return i; } } return -1; }
java
public static int endsWith(String str, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].endsWith(str) ) { return i; } } return -1; }
[ "public", "static", "int", "endsWith", "(", "String", "str", ",", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "lengt...
check if there is an element that ends with the specified string @param str @return int
[ "check", "if", "there", "is", "an", "element", "that", "ends", "with", "the", "specified", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L84-L97
55,772
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.contains
public static int contains(String str, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].contains(str) ) { return i; } } return -1; }
java
public static int contains(String str, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].contains(str) ) { return i; } } return -1; }
[ "public", "static", "int", "contains", "(", "String", "str", ",", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "lengt...
check if there is an element that contains the specified string @param str @return int
[ "check", "if", "there", "is", "an", "element", "that", "contains", "the", "specified", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L105-L118
55,773
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.toJsonObject
public static String toJsonObject(String[] arr) { if ( arr == null ) { return null; } StringBuffer sb = new StringBuffer(); sb.append('{'); for ( String ele : arr ) { if ( sb.length() == 1 ) { sb.append('"').append(ele).append(...
java
public static String toJsonObject(String[] arr) { if ( arr == null ) { return null; } StringBuffer sb = new StringBuffer(); sb.append('{'); for ( String ele : arr ) { if ( sb.length() == 1 ) { sb.append('"').append(ele).append(...
[ "public", "static", "String", "toJsonObject", "(", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "return", "null", ";", "}", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", ...
implode the array elements as a Json array string @param arr @return String
[ "implode", "the", "array", "elements", "as", "a", "Json", "array", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L126-L144
55,774
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java
TextRankSummaryExtractor.textToSentence
List<Sentence> textToSentence(Reader reader) throws IOException { List<Sentence> sentence = new ArrayList<Sentence>(); Sentence sen = null; sentenceSeg.reset(reader); while ( (sen = sentenceSeg.next()) != null ) { sentence.add(sen); } ret...
java
List<Sentence> textToSentence(Reader reader) throws IOException { List<Sentence> sentence = new ArrayList<Sentence>(); Sentence sen = null; sentenceSeg.reset(reader); while ( (sen = sentenceSeg.next()) != null ) { sentence.add(sen); } ret...
[ "List", "<", "Sentence", ">", "textToSentence", "(", "Reader", "reader", ")", "throws", "IOException", "{", "List", "<", "Sentence", ">", "sentence", "=", "new", "ArrayList", "<", "Sentence", ">", "(", ")", ";", "Sentence", "sen", "=", "null", ";", "sent...
text doc to sentence @param reader @return List<Sentence> @throws IOException
[ "text", "doc", "to", "sentence" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java#L50-L61
55,775
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java
TextRankSummaryExtractor.sentenceTokenize
List<List<IWord>> sentenceTokenize(List<Sentence> sentence) throws IOException { List<List<IWord>> senWords = new ArrayList<List<IWord>>(); for ( Sentence sen : sentence ) { List<IWord> words = new ArrayList<IWord>(); wordSeg.reset(new StringReader(sen.getValue())); ...
java
List<List<IWord>> sentenceTokenize(List<Sentence> sentence) throws IOException { List<List<IWord>> senWords = new ArrayList<List<IWord>>(); for ( Sentence sen : sentence ) { List<IWord> words = new ArrayList<IWord>(); wordSeg.reset(new StringReader(sen.getValue())); ...
[ "List", "<", "List", "<", "IWord", ">", ">", "sentenceTokenize", "(", "List", "<", "Sentence", ">", "sentence", ")", "throws", "IOException", "{", "List", "<", "List", "<", "IWord", ">>", "senWords", "=", "new", "ArrayList", "<", "List", "<", "IWord", ...
sentence to words @param sentence @return List<List<IWord>> @throws IOException
[ "sentence", "to", "words" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java#L70-L85
55,776
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java
TextRankSummaryExtractor.textRankSortedDocuments
protected Document[] textRankSortedDocuments( List<Sentence> sentence, List<List<IWord>> senWords) throws IOException { int docNum = sentence.size(); //documents relevance matrix build double[][] relevance = BM25RelevanceMatixBuild(sentence, senWords); //org.lionsoul...
java
protected Document[] textRankSortedDocuments( List<Sentence> sentence, List<List<IWord>> senWords) throws IOException { int docNum = sentence.size(); //documents relevance matrix build double[][] relevance = BM25RelevanceMatixBuild(sentence, senWords); //org.lionsoul...
[ "protected", "Document", "[", "]", "textRankSortedDocuments", "(", "List", "<", "Sentence", ">", "sentence", ",", "List", "<", "List", "<", "IWord", ">", ">", "senWords", ")", "throws", "IOException", "{", "int", "docNum", "=", "sentence", ".", "size", "("...
get the documents order by relevance score. @param sentence @param senWords @throws IOException
[ "get", "the", "documents", "order", "by", "relevance", "score", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/impl/TextRankSummaryExtractor.java#L202-L253
55,777
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java
TimeUtil.createDateTimePool
public static final IWord[] createDateTimePool() { return new IWord[]{ null, //year null, //month null, //day null, //timing method null, //hour null, //minute null, //seconds }; }
java
public static final IWord[] createDateTimePool() { return new IWord[]{ null, //year null, //month null, //day null, //timing method null, //hour null, //minute null, //seconds }; }
[ "public", "static", "final", "IWord", "[", "]", "createDateTimePool", "(", ")", "{", "return", "new", "IWord", "[", "]", "{", "null", ",", "//year", "null", ",", "//month", "null", ",", "//day", "null", ",", "//timing method", "null", ",", "//hour", "nul...
create and return a date-time pool @return IWord[]
[ "create", "and", "return", "a", "date", "-", "time", "pool" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java#L79-L90
55,778
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java
TimeUtil.fillDateTimePool
public static final int fillDateTimePool(IWord[] wPool, IWord word) { int pIdx = getDateTimeIndex(word.getEntity(0)); if ( pIdx == DATETIME_NONE ) { return DATETIME_NONE; } if ( wPool[pIdx] == null ) { wPool[pIdx] = word; return pIdx; ...
java
public static final int fillDateTimePool(IWord[] wPool, IWord word) { int pIdx = getDateTimeIndex(word.getEntity(0)); if ( pIdx == DATETIME_NONE ) { return DATETIME_NONE; } if ( wPool[pIdx] == null ) { wPool[pIdx] = word; return pIdx; ...
[ "public", "static", "final", "int", "fillDateTimePool", "(", "IWord", "[", "]", "wPool", ",", "IWord", "word", ")", "{", "int", "pIdx", "=", "getDateTimeIndex", "(", "word", ".", "getEntity", "(", "0", ")", ")", ";", "if", "(", "pIdx", "==", "DATETIME_...
fill the date-time pool specified part through the specified time entity string. @param wPool @param word @return int
[ "fill", "the", "date", "-", "time", "pool", "specified", "part", "through", "the", "specified", "time", "entity", "string", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java#L100-L113
55,779
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java
TimeUtil.fillDateTimePool
public static final void fillDateTimePool( IWord[] wPool, int pIdx, IWord word) { if ( wPool[pIdx] == null ) { wPool[pIdx] = word; } }
java
public static final void fillDateTimePool( IWord[] wPool, int pIdx, IWord word) { if ( wPool[pIdx] == null ) { wPool[pIdx] = word; } }
[ "public", "static", "final", "void", "fillDateTimePool", "(", "IWord", "[", "]", "wPool", ",", "int", "pIdx", ",", "IWord", "word", ")", "{", "if", "(", "wPool", "[", "pIdx", "]", "==", "null", ")", "{", "wPool", "[", "pIdx", "]", "=", "word", ";",...
fill the date-time pool specified part with part index constant @param wPool @param pIdx @param word
[ "fill", "the", "date", "-", "time", "pool", "specified", "part", "with", "part", "index", "constant" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java#L122-L128
55,780
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java
TimeUtil.getTimeKey
public static final String getTimeKey(String entity) { if ( entity == null ) { return null; } int sIdx = entity.indexOf('.'); if ( sIdx == -1 ) { return null; } return entity.substring(sIdx + 1); }
java
public static final String getTimeKey(String entity) { if ( entity == null ) { return null; } int sIdx = entity.indexOf('.'); if ( sIdx == -1 ) { return null; } return entity.substring(sIdx + 1); }
[ "public", "static", "final", "String", "getTimeKey", "(", "String", "entity", ")", "{", "if", "(", "entity", "==", "null", ")", "{", "return", "null", ";", "}", "int", "sIdx", "=", "entity", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "sIdx...
get and return the time key part of the specified entity string @param entity @return String
[ "get", "and", "return", "the", "time", "key", "part", "of", "the", "specified", "entity", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/TimeUtil.java#L136-L148
55,781
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/sentence/SentenceSeg.java
SentenceSeg.readUntil
protected void readUntil(char echar) throws IOException { int ch, i = 0; IStringBuffer sb = new IStringBuffer(); while ( (ch = readNext()) != -1 ) { if ( ++i >= MAX_QUOTE_LENGTH ) { /* * push back the readed chars * and reset the ...
java
protected void readUntil(char echar) throws IOException { int ch, i = 0; IStringBuffer sb = new IStringBuffer(); while ( (ch = readNext()) != -1 ) { if ( ++i >= MAX_QUOTE_LENGTH ) { /* * push back the readed chars * and reset the ...
[ "protected", "void", "readUntil", "(", "char", "echar", ")", "throws", "IOException", "{", "int", "ch", ",", "i", "=", "0", ";", "IStringBuffer", "sb", "=", "new", "IStringBuffer", "(", ")", ";", "while", "(", "(", "ch", "=", "readNext", "(", ")", ")...
loop the reader until the specifield char is found. @param echar @throws IOException
[ "loop", "the", "reader", "until", "the", "specifield", "char", "is", "found", "." ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/sentence/SentenceSeg.java#L186-L211
55,782
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/IIntQueue.java
IIntQueue.enQueue
public boolean enQueue( int data ) { Entry o = new Entry(data, tail.prev, tail); tail.prev.next = o; tail.prev = o; //set the size size++; return true; }
java
public boolean enQueue( int data ) { Entry o = new Entry(data, tail.prev, tail); tail.prev.next = o; tail.prev = o; //set the size size++; return true; }
[ "public", "boolean", "enQueue", "(", "int", "data", ")", "{", "Entry", "o", "=", "new", "Entry", "(", "data", ",", "tail", ".", "prev", ",", "tail", ")", ";", "tail", ".", "prev", ".", "next", "=", "o", ";", "tail", ".", "prev", "=", "o", ";", ...
append a int from the tail @param data @return boolean
[ "append", "a", "int", "from", "the", "tail" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/IIntQueue.java#L30-L40
55,783
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/IHashQueue.java
IHashQueue.add
public boolean add( T word ) { Entry<T> o = new Entry<T>(word, tail.prev, tail); tail.prev.next = o; tail.prev = o; //set the size and set the index size++; index.put(word.getValue(), word); return true; }
java
public boolean add( T word ) { Entry<T> o = new Entry<T>(word, tail.prev, tail); tail.prev.next = o; tail.prev = o; //set the size and set the index size++; index.put(word.getValue(), word); return true; }
[ "public", "boolean", "add", "(", "T", "word", ")", "{", "Entry", "<", "T", ">", "o", "=", "new", "Entry", "<", "T", ">", "(", "word", ",", "tail", ".", "prev", ",", "tail", ")", ";", "tail", ".", "prev", ".", "next", "=", "o", ";", "tail", ...
append a item from the tail @param word @return boolean
[ "append", "a", "item", "from", "the", "tail" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/IHashQueue.java#L49-L60
55,784
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/SummaryExtractor.java
SummaryExtractor.getSummaryFromString
public String getSummaryFromString(String doc, int length) throws IOException { return getSummary(new StringReader(doc), length); }
java
public String getSummaryFromString(String doc, int length) throws IOException { return getSummary(new StringReader(doc), length); }
[ "public", "String", "getSummaryFromString", "(", "String", "doc", ",", "int", "length", ")", "throws", "IOException", "{", "return", "getSummary", "(", "new", "StringReader", "(", "doc", ")", ",", "length", ")", ";", "}" ]
get document summary from a string @param doc @param length @return String @throws IOException
[ "get", "document", "summary", "from", "a", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/SummaryExtractor.java#L83-L86
55,785
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/SummaryExtractor.java
SummaryExtractor.getSummaryFromFile
public String getSummaryFromFile(String file, int length) throws IOException { return getSummary(new FileReader(file), length); }
java
public String getSummaryFromFile(String file, int length) throws IOException { return getSummary(new FileReader(file), length); }
[ "public", "String", "getSummaryFromFile", "(", "String", "file", ",", "int", "length", ")", "throws", "IOException", "{", "return", "getSummary", "(", "new", "FileReader", "(", "file", ")", ",", "length", ")", ";", "}" ]
get document summary from a file @param file @param length @return String @throws IOException
[ "get", "document", "summary", "from", "a", "file" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/SummaryExtractor.java#L97-L100
55,786
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java
EntityFormat.isMailAddress
public final static boolean isMailAddress(String str) { int atIndex = str.indexOf('@'); if ( atIndex == -1 ) { return false; } if ( ! StringUtil.isLetterOrNumeric(str, 0, atIndex) ) { return false; } int ptIndex, ptStart = atI...
java
public final static boolean isMailAddress(String str) { int atIndex = str.indexOf('@'); if ( atIndex == -1 ) { return false; } if ( ! StringUtil.isLetterOrNumeric(str, 0, atIndex) ) { return false; } int ptIndex, ptStart = atI...
[ "public", "final", "static", "boolean", "isMailAddress", "(", "String", "str", ")", "{", "int", "atIndex", "=", "str", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "atIndex", "==", "-", "1", ")", "{", "return", "false", ";", "}", "if", "(", ...
check if the specified string is an email address or not @param str @return boolean
[ "check", "if", "the", "specified", "string", "is", "an", "email", "address", "or", "not" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java#L19-L49
55,787
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java
EntityFormat.isUrlAddress
public final static boolean isUrlAddress(String str, ADictionary dic) { int prIndex = str.indexOf("://"); if ( prIndex > -1 && ! StringUtil.isLatin(str, 0, prIndex) ) { return false; } int sIdx = prIndex > -1 ? prIndex + 3 : 0; int slIndex = str.indexOf('...
java
public final static boolean isUrlAddress(String str, ADictionary dic) { int prIndex = str.indexOf("://"); if ( prIndex > -1 && ! StringUtil.isLatin(str, 0, prIndex) ) { return false; } int sIdx = prIndex > -1 ? prIndex + 3 : 0; int slIndex = str.indexOf('...
[ "public", "final", "static", "boolean", "isUrlAddress", "(", "String", "str", ",", "ADictionary", "dic", ")", "{", "int", "prIndex", "=", "str", ".", "indexOf", "(", "\"://\"", ")", ";", "if", "(", "prIndex", ">", "-", "1", "&&", "!", "StringUtil", "."...
check if the specified string is an URL address or not @param str @param dic optional dictionary object @return boolean
[ "check", "if", "the", "specified", "string", "is", "an", "URL", "address", "or", "not" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java#L58-L119
55,788
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java
EntityFormat.isMobileNumber
public static final boolean isMobileNumber(String str) { if ( str.length() != 11 ) { return false; } if ( str.charAt(0) != '1' ) { return false; } if ( "34578".indexOf(str.charAt(1)) == -1 ) { return false; } ...
java
public static final boolean isMobileNumber(String str) { if ( str.length() != 11 ) { return false; } if ( str.charAt(0) != '1' ) { return false; } if ( "34578".indexOf(str.charAt(1)) == -1 ) { return false; } ...
[ "public", "static", "final", "boolean", "isMobileNumber", "(", "String", "str", ")", "{", "if", "(", "str", ".", "length", "(", ")", "!=", "11", ")", "{", "return", "false", ";", "}", "if", "(", "str", ".", "charAt", "(", "0", ")", "!=", "'", "'"...
check if the specified string is a mobile number @param str @return boolean
[ "check", "if", "the", "specified", "string", "is", "a", "mobile", "number" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/EntityFormat.java#L127-L142
55,789
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isCJKChar
public static boolean isCJKChar( int c ) { /* * @Note: added at 2015-11-25 * for foreign country translated name recognize * add '·' as CJK chars */ if ( c == 183 || Character.getType(c) == Character.OTHER_LETTER ) return true; ...
java
public static boolean isCJKChar( int c ) { /* * @Note: added at 2015-11-25 * for foreign country translated name recognize * add '·' as CJK chars */ if ( c == 183 || Character.getType(c) == Character.OTHER_LETTER ) return true; ...
[ "public", "static", "boolean", "isCJKChar", "(", "int", "c", ")", "{", "/*\n * @Note: added at 2015-11-25\n * for foreign country translated name recognize\n * add '·' as CJK chars\n */", "if", "(", "c", "==", "183", "||", "Character", ".", "getType...
check the specified char is CJK, Thai... char true will be return if it is or return false @param c @return boolean
[ "check", "the", "specified", "char", "is", "CJK", "Thai", "...", "char", "true", "will", "be", "return", "if", "it", "is", "or", "return", "false" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L37-L48
55,790
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isEnPunctuation
public static boolean isEnPunctuation( int c ) { return ( (c > 32 && c < 48) || ( c > 57 && c < 65 ) || ( c > 90 && c < 97 ) || ( c > 122 && c < 127 ) ); }
java
public static boolean isEnPunctuation( int c ) { return ( (c > 32 && c < 48) || ( c > 57 && c < 65 ) || ( c > 90 && c < 97 ) || ( c > 122 && c < 127 ) ); }
[ "public", "static", "boolean", "isEnPunctuation", "(", "int", "c", ")", "{", "return", "(", "(", "c", ">", "32", "&&", "c", "<", "48", ")", "||", "(", "c", ">", "57", "&&", "c", "<", "65", ")", "||", "(", "c", ">", "90", "&&", "c", "<", "97...
check the given char is half-width punctuation @param c @return boolean
[ "check", "the", "given", "char", "is", "half", "-", "width", "punctuation" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L231-L238
55,791
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isDigit
public static boolean isDigit(String str, int beginIndex, int endIndex) { char c; for ( int j = beginIndex; j < endIndex; j++ ) { c = str.charAt(j); //make full-width char half-width if ( c > 65280 ) c -= 65248; if ( c < 48 || c > 57 ) { ...
java
public static boolean isDigit(String str, int beginIndex, int endIndex) { char c; for ( int j = beginIndex; j < endIndex; j++ ) { c = str.charAt(j); //make full-width char half-width if ( c > 65280 ) c -= 65248; if ( c < 48 || c > 57 ) { ...
[ "public", "static", "boolean", "isDigit", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "char", "c", ";", "for", "(", "int", "j", "=", "beginIndex", ";", "j", "<", "endIndex", ";", "j", "++", ")", "{", "c", "=", ...
check the specified char is a digit or not true will return if it is or return false this method can recognize full-with char @param str @param beginIndex @param endIndex @return boolean
[ "check", "the", "specified", "char", "is", "a", "digit", "or", "not", "true", "will", "return", "if", "it", "is", "or", "return", "false", "this", "method", "can", "recognize", "full", "-", "with", "char" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L272-L285
55,792
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isDecimal
public static boolean isDecimal(String str, int beginIndex, int endIndex) { if ( str.charAt(str.length() - 1) == '.' || str.charAt(0) == '.' ) { return false; } char c; int p= 0; //number of point for ( int j = 1; j < str.length(); j++ ) { ...
java
public static boolean isDecimal(String str, int beginIndex, int endIndex) { if ( str.charAt(str.length() - 1) == '.' || str.charAt(0) == '.' ) { return false; } char c; int p= 0; //number of point for ( int j = 1; j < str.length(); j++ ) { ...
[ "public", "static", "boolean", "isDecimal", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "if", "(", "str", ".", "charAt", "(", "str", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", "||", "str", ".", "...
check the specified char is a decimal including the full-width char @param str @param beginIndex @param endIndex @return boolean
[ "check", "the", "specified", "char", "is", "a", "decimal", "including", "the", "full", "-", "width", "char" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L298-L319
55,793
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isLatin
public static boolean isLatin(String str, int beginIndex, int endIndex) { for ( int j = beginIndex; j < endIndex; j++ ) { if ( ! isEnChar(str.charAt(j)) ) { return false; } } return true; }
java
public static boolean isLatin(String str, int beginIndex, int endIndex) { for ( int j = beginIndex; j < endIndex; j++ ) { if ( ! isEnChar(str.charAt(j)) ) { return false; } } return true; }
[ "public", "static", "boolean", "isLatin", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "for", "(", "int", "j", "=", "beginIndex", ";", "j", "<", "endIndex", ";", "j", "++", ")", "{", "if", "(", "!", "isEnChar", ...
check if the specified string is all Latin chars @param str @param beginIndex @param endIndex @return boolean
[ "check", "if", "the", "specified", "string", "is", "all", "Latin", "chars" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L332-L341
55,794
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isCJK
public static boolean isCJK(String str, int beginIndex, int endIndex) { for ( int j = beginIndex; j < endIndex; j++ ) { if ( ! isCJKChar(str.charAt(j)) ) { return false; } } return true; }
java
public static boolean isCJK(String str, int beginIndex, int endIndex) { for ( int j = beginIndex; j < endIndex; j++ ) { if ( ! isCJKChar(str.charAt(j)) ) { return false; } } return true; }
[ "public", "static", "boolean", "isCJK", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "for", "(", "int", "j", "=", "beginIndex", ";", "j", "<", "endIndex", ";", "j", "++", ")", "{", "if", "(", "!", "isCJKChar", "...
check if the specified string is all CJK chars @param str @param beginIndex @param endIndex @return boolean
[ "check", "if", "the", "specified", "string", "is", "all", "CJK", "chars" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L353-L362
55,795
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isLetterOrNumeric
public static boolean isLetterOrNumeric(String str, int beginIndex, int endIndex) { for ( int i = beginIndex; i < endIndex; i++ ) { char chr = str.charAt(i); if ( ! StringUtil.isEnLetter(chr) && ! StringUtil.isEnNumeric(chr) ) { return false; ...
java
public static boolean isLetterOrNumeric(String str, int beginIndex, int endIndex) { for ( int i = beginIndex; i < endIndex; i++ ) { char chr = str.charAt(i); if ( ! StringUtil.isEnLetter(chr) && ! StringUtil.isEnNumeric(chr) ) { return false; ...
[ "public", "static", "boolean", "isLetterOrNumeric", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "for", "(", "int", "i", "=", "beginIndex", ";", "i", "<", "endIndex", ";", "i", "++", ")", "{", "char", "chr", "=", ...
check if the specified string is Latin numeric or letter @param str @param beginIndex @param endIndex @return boolean
[ "check", "if", "the", "specified", "string", "is", "Latin", "numeric", "or", "letter" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L374-L385
55,796
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isLetter
public static boolean isLetter(String str, int beginIndex, int endIndex) { for ( int i = beginIndex; i < endIndex; i++ ) { char chr = str.charAt(i); if ( ! StringUtil.isEnLetter(chr) ) { return false; } } return true; }
java
public static boolean isLetter(String str, int beginIndex, int endIndex) { for ( int i = beginIndex; i < endIndex; i++ ) { char chr = str.charAt(i); if ( ! StringUtil.isEnLetter(chr) ) { return false; } } return true; }
[ "public", "static", "boolean", "isLetter", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "for", "(", "int", "i", "=", "beginIndex", ";", "i", "<", "endIndex", ";", "i", "++", ")", "{", "char", "chr", "=", "str", ...
check if the specified string is Latin letter @param str @param beginIndex @param endIndex @return boolean
[ "check", "if", "the", "specified", "string", "is", "Latin", "letter" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L397-L407
55,797
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.isNumeric
public static boolean isNumeric(String str, int beginIndex, int endIndex) { for ( int i = beginIndex; i < endIndex; i++ ) { char chr = str.charAt(i); if ( ! StringUtil.isEnNumeric(chr) ) { return false; } } return true; }
java
public static boolean isNumeric(String str, int beginIndex, int endIndex) { for ( int i = beginIndex; i < endIndex; i++ ) { char chr = str.charAt(i); if ( ! StringUtil.isEnNumeric(chr) ) { return false; } } return true; }
[ "public", "static", "boolean", "isNumeric", "(", "String", "str", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "for", "(", "int", "i", "=", "beginIndex", ";", "i", "<", "endIndex", ";", "i", "++", ")", "{", "char", "chr", "=", "str", ...
check if the specified string it Latin numeric @param str @param beginIndex @param endIndex @return boolean
[ "check", "if", "the", "specified", "string", "it", "Latin", "numeric" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L419-L429
55,798
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.latinIndexOf
public static int latinIndexOf(String str, int offset) { for ( int j = offset; j < str.length(); j++ ) { if ( isEnChar(str.charAt(j)) ) { return j; } } return -1; }
java
public static int latinIndexOf(String str, int offset) { for ( int j = offset; j < str.length(); j++ ) { if ( isEnChar(str.charAt(j)) ) { return j; } } return -1; }
[ "public", "static", "int", "latinIndexOf", "(", "String", "str", ",", "int", "offset", ")", "{", "for", "(", "int", "j", "=", "offset", ";", "j", "<", "str", ".", "length", "(", ")", ";", "j", "++", ")", "{", "if", "(", "isEnChar", "(", "str", ...
get the index of the first Latin char of the specified string @param str @param offset @return integer
[ "get", "the", "index", "of", "the", "first", "Latin", "char", "of", "the", "specified", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L440-L449
55,799
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.CJKIndexOf
public static int CJKIndexOf(String str, int offset) { for ( int j = offset; j < str.length(); j++ ) { if ( isCJKChar(str.charAt(j)) ) { return j; } } return -1; }
java
public static int CJKIndexOf(String str, int offset) { for ( int j = offset; j < str.length(); j++ ) { if ( isCJKChar(str.charAt(j)) ) { return j; } } return -1; }
[ "public", "static", "int", "CJKIndexOf", "(", "String", "str", ",", "int", "offset", ")", "{", "for", "(", "int", "j", "=", "offset", ";", "j", "<", "str", ".", "length", "(", ")", ";", "j", "++", ")", "{", "if", "(", "isCJKChar", "(", "str", "...
get the index of the first CJK char of the specified string @param str @param offset @return integer
[ "get", "the", "index", "of", "the", "first", "CJK", "char", "of", "the", "specified", "string" ]
7c8a912e3bbcaf4f8de701180b9c24e2e444a94b
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L463-L472