在PHP项目中使用Standford Moss

Standford Moss 系统是斯坦福大学大名鼎鼎的代码查重系统,它可以查出哪些同学提交的代码是抄袭别人的,从而将提交结果拒之门外。它对一切希望使用该系统的人都是开放的,那么在PHP的项目中如何使用它呢?

  1. 下载Moss的PHP文件moss.php

    您可以访问https://github.com/Phhere/MOSS-PHP 来下载moss.php,并将它放在您的第三方扩展库中


  2. 使用moss.php

    通过下面的范例代码您就可以简单的做个moss小测试了

<?php include("moss.php"); $userid = ""; // Enter your MOSS userid $moss = new MOSS($userid); $moss->setLanguage('java'); $moss->addByWildcard('test/*'); $moss->addBaseFile('Example.java'); $moss->setCommentString("This is a test"); print_r($moss->send()); ?>

这个代码是使用moss.php来完成Java代码的查重。然而遗憾的是需要$userid.

3.获取userid

既然是开放的系统,那么获取它的账户也是有方法的,那就是发送Email。

发送Email至moss@moss.stanford.edu,在邮件中包含

registeruser mail 你的Email地址(可能会用来作为userid)

接下来就是等待回复了。有了userid就可以愉快的使用Moss了。

本文首发于 顶求网,转载请注明来源

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用Stanford CoreNLP获得情感得分,您需要遵循以下步骤: 1. 安装Java和Stanford CoreNLP 要使用Stanford CoreNLP,您需要Java 1.8或更高版本。您可以在此处下载Java:https://www.java.com/en/download/ 然后,您需要下载并安装Stanford CoreNLP。您可以在此处下载Stanford CoreNLP:https://stanfordnlp.github.io/CoreNLP/ 2. 导入Stanford CoreNLP库 在您的Java代码,您需要导入Stanford CoreNLP库。例如,如果您使用Maven,可以将以下依赖项添加到您的pom.xml文件: ``` <dependency> <groupId>edu.stanford.nlp</groupId> <artifactId>stanford-corenlp</artifactId> <version>4.2.2</version> </dependency> ``` 3. 创建情感分析器 创建一个情感分析器对象,它将用于分析文本并返回情感得分。以下是示例代码: ``` import edu.stanford.nlp.pipeline.*; import edu.stanford.nlp.sentiment.*; Properties props = new Properties(); props.setProperty("annotators", "tokenize, ssplit, parse, sentiment"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); ``` 4. 分析文本 使用情感分析器对象分析文本,并返回情感得分。以下是示例代码: ``` String text = "I love this product! It's amazing!"; Annotation annotation = pipeline.process(text); List<CoreMap> sentences = annotation.get(CoreAnnotations.SentencesAnnotation.class); for (CoreMap sentence : sentences) { String sentiment = sentence.get(SentimentCoreAnnotations.SentimentClass.class); System.out.println("Sentiment: " + sentiment); } ``` 在这个例子,我们使用情感分析器来分析文本“我喜欢这个产品!它太棒了!”。我们使用pipeline.process方法来处理文本,并获取分析结果。然后,我们使用SentimentCoreAnnotations.SentimentClass类来获取情感得分,并将其输出到控制台。 输出将是“Sentiment: Positive”,这意味着这个文本被分类为积极的情感。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值