本文整理汇总了Python中evaluator.Evaluator.get_argument_parser方法的典型用法代码示例。如果您正苦于以下问题:Python Evaluator.get_argument_parser方法的具体用法?Python Evaluator.get_argument_parser怎么用?Python Evaluator.get_argument_parser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类evaluator.Evaluator
的用法示例。
在下文中一共展示了Evaluator.get_argument_parser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PdfMinerEvaluator
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import get_argument_parser [as 别名]
from evaluator import Evaluator
class PdfMinerEvaluator(Evaluator):
pass
if __name__ == "__main__":
PdfMinerEvaluator(Evaluator.get_argument_parser().parse_args()).evaluate()
示例2: PdfToXmlEvaluator
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import get_argument_parser [as 别名]
from evaluator import Evaluator
from lxml import etree
from os.path import isfile
blocks_xpath = """/DOCUMENT/PAGE/BLOCK"""
token_xpath = """./TEXT/TOKEN"""
class PdfToXmlEvaluator(Evaluator):
def format_actual_file(self, file_path):
''' Reads the given actual file. Override it if you have to do more
advanced stuff, like removing semantic markups, etc.'''
if isfile(file_path):
xml = etree.parse(file_path, etree.XMLParser(recover=True))
block_nodes = xml.xpath(blocks_xpath)
blocks = []
for block_node in block_nodes:
token_nodes = block_node.xpath(token_xpath)
blocks.append(" ".join([x.text for x in token_nodes if x.text is not None]))
return "\n\n".join(blocks)
return ""
if __name__ == "__main__":
PdfToXmlEvaluator(Evaluator.get_argument_parser().parse_args()).evaluate()
示例3: pdfextractEvaluator
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import get_argument_parser [as 别名]
title_xpath = "title"
sections_xpath = "(/pdf/section)"
line_xpath = "(./line)"
class pdfextractEvaluator(Evaluator):
def format_actual_file(self, file_path):
''' Reads the given actual file. Override it if you have to do more
advanced stuff, like removing semantic markups, etc.'''
if isfile(file_path) and getsize(file_path) > 0:
xml = etree.parse(file_path, etree.XMLParser(recover=True))
sections = []
# Extract the title.
title_nodes = xml.xpath(title_xpath)
sections.append("".join([x.text.replace("\n", " ").strip() for x in title_nodes]))
# Extract the lines.
section_nodes = xml.xpath(sections_xpath)
for node in section_nodes:
line_nodes = node.xpath(line_xpath)
sections.append("\n".join([x.text.replace("\n", " ").strip() for x in line_nodes if x is not None and x.text is not None]))
return "\n\n".join(sections)
return ""
if __name__ == "__main__":
pdfextractEvaluator(Evaluator.get_argument_parser().parse_args()).evaluate()
示例4: IceciteEvaluator
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import get_argument_parser [as 别名]
from evaluator import Evaluator
class IceciteEvaluator(Evaluator):
pass
if __name__ == "__main__":
IceciteEvaluator(Evaluator.get_argument_parser().parse_args()).evaluate()
示例5: LaPdfTextEvaluator
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import get_argument_parser [as 别名]
from evaluator import Evaluator
class LaPdfTextEvaluator(Evaluator):
pass
if __name__ == "__main__":
LaPdfTextEvaluator(Evaluator.get_argument_parser().parse_args()).evaluate()
示例6: pdfXtkEvaluator
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import get_argument_parser [as 别名]
from evaluator import Evaluator
from lxml import etree
from os.path import isfile
text_blocks_xpath = "(/PDFResult/page/text-block)"
class pdfXtkEvaluator(Evaluator):
def format_actual_file(self, file_path):
''' Reads the given actual file. Override it if you have to do more
advanced stuff, like removing semantic markups, etc.'''
if isfile(file_path):
xml = etree.parse(file_path, etree.XMLParser(recover=True))
text_block_nodes = xml.xpath(text_blocks_xpath)
text_blocks = [x.text for x in text_block_nodes if x.text != "[empty:empty]" and x.text != "[empty:spaces]"]
return "\n\n".join(text_blocks)
return ""
if __name__ == "__main__":
pdfXtkEvaluator(Evaluator.get_argument_parser().parse_args()).evaluate()