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


Python Analyzer.process_data方法代码示例

本文整理汇总了Python中analyzer.Analyzer.process_data方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.process_data方法的具体用法?Python Analyzer.process_data怎么用?Python Analyzer.process_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在analyzer.Analyzer的用法示例。


在下文中一共展示了Analyzer.process_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import process_data [as 别名]
class Manager:
    """
    Actual object to manage everything
  """

    # reference to the entire data storage
    __cache = None

    # reference to object managing articles access and storage
    __articles = None

    # reference to the object doing the analysis
    __analyzer = None

    def __init__(self, config):
        """
      Prepare the entire system's objects

      config - the configuration object from the click library
    """
        yaml_config = yaml.load(config.obj["config"])
        config.obj["config"].close()
        self.__cache = Cache(db_file=config.obj["database"])
        self.__articles = Articles(key=yaml_config["api_key"], cache=self.__cache)
        self.__analyzer = Analyzer()

    def perform_search(self, phrase, training_size=1000):
        """
      Perform the actual search either to cache or ny times

      phrase - the phrase to search by
      training_size - the amount of articles to use and fetch

      returns the list of found articles
    """
        return self.__articles.perform_search(phrase, training_size)

    def analyze_results(self, article_list):
        """
      Perform the regression analysis on the results and print
      them out to the command line
    """
        print("Using %i articles" % (len(article_list),))
        self.__analyzer.process_data(article_list)

    def predict_result(self, date):
        """
      Make a prediction on a date

      date - a datetime to make a prediction on

      return a tuple of the type of article created from the analyzer
    """
        return self.__analyzer.predict(date)
开发者ID:amchang,项目名称:what-will-be-written,代码行数:56,代码来源:manager.py

示例2: analyze

# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import process_data [as 别名]
 def analyze(self, filePath):
     """
         Analyze a file.
         @param filePath Path to the file.
     """
     print("Analyzing book located at: %s" % filePath)
     try:
         with codecs.open(filePath, 'r', 'utf8') as book:
             book_contents = book.read()
     except:
         raise BookAnalyzerException("Error: Unable to read book.")
     analyzer = Analyzer()
     analyzer.process_data(book_contents)
     analyzer.report_results()
开发者ID:mattdevs,项目名称:book_analyzer,代码行数:16,代码来源:book_analyzer.py


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