本文整理汇总了Python中py4j.java_gateway.JavaGateway.createSSFStory方法的典型用法代码示例。如果您正苦于以下问题:Python JavaGateway.createSSFStory方法的具体用法?Python JavaGateway.createSSFStory怎么用?Python JavaGateway.createSSFStory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py4j.java_gateway.JavaGateway
的用法示例。
在下文中一共展示了JavaGateway.createSSFStory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JavaGateway
# 需要导入模块: from py4j.java_gateway import JavaGateway [as 别名]
# 或者: from py4j.java_gateway.JavaGateway import createSSFStory [as 别名]
from py4j.java_gateway import JavaGateway
gateway = JavaGateway()
story = gateway.createSSFStory()
story.readFile("workspace/syn-annotation/Premchand/poslcat-single-fs-1.txt", "UTF-8")
count = story.countSentences()
print("Number of sentences: " + str(count))
sen = story.getSentence(0)
print(sen.makeString())
root = sen.getRoot()
leaves = root.getAllLeaves()
print("Number of words: " + str(len(leaves)))
w1 = leaves[0]
print(w1.makeString())
print("Changing tag:")
w1.setName("NewTag")
print(w1.makeString())