当前位置: 首页>>代码示例>>Python>>正文


Python Evaluator.get_argument_parser方法代码示例

本文整理汇总了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() 
开发者ID:ckorzen,项目名称:arxiv-benchmark,代码行数:9,代码来源:evaluator-pdfminer.py

示例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() 
开发者ID:ckorzen,项目名称:arxiv-benchmark,代码行数:27,代码来源:evaluator-pdftoxml.py

示例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()
开发者ID:ckorzen,项目名称:arxiv-benchmark,代码行数:31,代码来源:evaluator-pdfextract.py

示例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() 
开发者ID:ckorzen,项目名称:arxiv-benchmark,代码行数:9,代码来源:evaluator-icecite.py

示例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() 
开发者ID:ckorzen,项目名称:arxiv-benchmark,代码行数:9,代码来源:evaluator-lapdftext.py

示例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()
开发者ID:ckorzen,项目名称:arxiv-benchmark,代码行数:24,代码来源:evaluator-pdfXtk.py


注:本文中的evaluator.Evaluator.get_argument_parser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。