Java项目有没有用于Java代码格式化的sbt插件?我做了一些搜索,但似乎所有基于 sbt 的格式化程序都适用于 Scala 的语法。
我正在寻找一种模糊substring
功能的方法.我是什么意思:
例1:
这是完全匹配,应该得分1.0.
例2:
这是模糊匹配,因为"weed"和"destroyed"出现在文本中,但没有"将会".它应该得到一个高分(比如0.8).
例3:
如果我们将"短"设置为"被破坏将是杂草",虽然"破坏"和"杂草"都出现在原始文本中,但分数应该非常低,因为它们的顺序已经改变.
对此有何建议实施?
最后一点是,没有独特的方法来进行评分.但我正在寻找AN算法.可以根据需要和要求调整该算法的参数.
在用于依赖解析的 SemanticGraph 类的定义中。
这是变量“roots”作为顶点集合的定义:
private final Collection<IndexedWord> roots;
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么要收藏?在什么情况下我们需要多个顶点作为根?
https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/semgraph/SemanticGraph.java
我正在尝试标准化我的网址中的邮件,而我正在使用URLEncoder.encode
.我得到的问题是,输出似乎不是一个有效的网址.例如
val text = Some("test question (a) x (b) y").get
val query = "http://localhost:8080/ask?text=" + text
println(query)
val queryEnc = URLEncoder.encode(query, "UTF-8")
println(queryEnc)
Run Code Online (Sandbox Code Playgroud)
输出:
http://localhost:8080/ask?text=test question (a) x (b) y
http%3A%2F%2Flocalhost%3A8080%2Fask%3Ftext%3Dtest+question+%28a%29+x+%28b%29+y
Run Code Online (Sandbox Code Playgroud)
输出是否是有效的URL?(它看起来没有效果,因为我机器上的Chrome和Safari无法识别它).
我正在将以下JSON变量转换为字符串.回到JSON时,我收到一个错误(在ReactJS中,虽然它不重要).
var questionGlobal = {
"questionCons": [{
"string": "In",
"alignment": 2
}, {
"string": "New York State",
"alignment": 1
}, {
"string": "the",
"alignment": -1
}, {
"string": "shortest",
"alignment": -1
}, {
"string": "period",
"alignment": 0
}, {
"string": "of",
"alignment": 2
}, {
"string": "daylight",
"alignment": 0
}, {
"string": "occurs",
"alignment": 2
}, {
"string": "during",
"alignment": 1
}, {
"string": "which",
"alignment": 0
}, {
"string": "month",
"alignment": 0
}],
"options": [{
"string": "January",
"alignment": 1 …
Run Code Online (Sandbox Code Playgroud) 我收到此错误:
[ERROR] /Users/daniel/ideaProjects/lbjava/lbjava/src/main/java/edu/illinois/cs/cogcomp/lbjava/learn/NaiveBayes.java:638: error: bad HTML entity
[ERROR] * P(e's label && e)
[ERROR] ^
[ERROR] /Users/daniel/ideaProjects/lbjava/lbjava/src/main/java/edu/illinois/cs/cogcomp/lbjava/learn/NaiveBayes.java:638: error: bad HTML entity
[ERROR] * P(e's label && e)
[ERROR] ^
Run Code Online (Sandbox Code Playgroud)
以下是完整评论:
/**
* Takes the dot product of this vector with the given vector, using the specified default
* weight when encountering a feature that is not yet present in this vector. Here, weights
* are taken as <i>log(feature count / prior count)</i>. The output of this method is
* related …
Run Code Online (Sandbox Code Playgroud) 我的运行失败,我认为由于位置地址中存在这个可疑字符"%402".当我通过终端检查文件夹名称时,此文件夹名称不存在,而它出现在Jenkins日志中.我想知道有没有类似的经历.
以下是错误日志中的代码段:
Results :
Tests in error:
testMultiThreading(edu.illinois.cs.cogcomp.edison.annotators.SimpleGazetteerAnnotatorTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
testAddView(edu.illinois.cs.cogcomp.edison.annotators.SimpleGazetteerAnnotatorTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
testSimpleGazetteerAnnotatorString(edu.illinois.cs.cogcomp.edison.annotators.SimpleGazetteerAnnotatorTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
testNonLazy(edu.illinois.cs.cogcomp.edison.annotators.AnnotatorLazyInitTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
testLazy(edu.illinois.cs.cogcomp.edison.annotators.AnnotatorLazyInitTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
和完整的错误日志:http://morgoth.cs.illinois.edu:8080/job /cogcomp-nlp/74/console
考虑以下片段
ASK WHERE { wd:Q734774 wdt:P31 wd:Q3918. }
Run Code Online (Sandbox Code Playgroud)
这在WikiData中可以正常工作。我想在此代码段中使用一些路径语法。具体来说,我想限制路径中使用“ wdt:P31”的次数。根据准则,这应该是正确的语法:
ASK WHERE { wd:Q734774 wdt:P31{,3} wd:Q3918. }
Run Code Online (Sandbox Code Playgroud)
但这给了我奇怪的错误信息。有任何想法吗?
是否有可能在多模块项目的模块之间存在循环依赖性?
这是一个例子:
lazy val client = (project in file("client"))
.dependsOn(service)
.settings(...)
lazy val service = (project in file("service"))
.dependsOn(client)
.settings(...)
Run Code Online (Sandbox Code Playgroud)
我得到一个错误recursive value x needs type
,我认为是由于这个递归定义,但不完全确定(可能会有一些其他奇怪的现象导致这种情况).
所以我一直在努力使用 Play inside sbt 设置内存设置:
javaOptions ++= Seq("-Xmx11G", "-Xms3G")
Run Code Online (Sandbox Code Playgroud)
但似乎并没有尊重它。
当我打印它时
val mb = 1024*1024
//Getting the runtime reference from system
val runtime = Runtime.getRuntime
println("##### Heap utilization statistics [MB] #####")
//Print used memory
println("Used Memory:" + (runtime.totalMemory() - runtime.freeMemory()) / mb)
//Print free memory
println("Free Memory:" + runtime.freeMemory() / mb)
//Print total available memory
println("Total Memory:" + runtime.totalMemory() / mb)
//Print Maximum available memory
println("Max Memory:" + runtime.maxMemory() / mb)
Run Code Online (Sandbox Code Playgroud)
这是我所看到的:
##### Heap utilization statistics [MB] #####
Used Memory:270 …
Run Code Online (Sandbox Code Playgroud) sbt ×3
scala ×3
java ×2
nlp ×2
algorithm ×1
javadoc ×1
javascript ×1
jenkins ×1
json ×1
reactjs ×1
sparql ×1
stanford-nlp ×1
substring ×1
url-encoding ×1
urlencode ×1
wikidata ×1
wikidata-api ×1