Пример #1
0
    def parseHistoryTexts(self, historyTexts, options):
        """Parse list of input histories and return tuple list with hand id and parsed history"""

        parseResult = []

        for historyText in historyTexts:
            analyzer = TxtAnalyzer(historyText)
            analyzer.analyze()

            # Skip if option not fulfilled
            if ((options.parseWhenHeroPlays and not analyzer.heroActs)
                    or (options.parseWhenPreflopOnly
                        and len(analyzer.flopActions) > 0) or
                (options.parseWhenFlopShown and len(analyzer.flopActions) == 0)
                    or (options.parseWhenFlopOnly and
                        (len(analyzer.flopActions) == 0
                         or len(analyzer.turnActions) > 0)) or
                (options.parseWhenTurnShown and len(analyzer.turnActions) == 0)
                    or (options.parseWhenRiverShown
                        and len(analyzer.riverActions) == 0)):
                continue
            # Print
            else:
                handprinter = HandPrinter(analyzer, options.ignoreHeroBetSize,
                                          options.useSimpleNames,
                                          options.includeSiteName)
                parsedHistory = handprinter.printHand()
                parseResult.append((analyzer.handId, parsedHistory))

        return parseResult
Пример #2
0
 def parseHistoryTexts(self, historyTexts, options):
     """Parse list of input histories and return tuple list with hand id and parsed history"""
     
     parseResult = []
     
     for historyText in historyTexts:
         analyzer = TxtAnalyzer(historyText)
         analyzer.analyze()
         
         # Skip if option not fulfilled
         if((options.parseWhenHeroPlays and not analyzer.heroActs)
            or (options.parseWhenPreflopOnly and len(analyzer.flopActions) > 0)
            or (options.parseWhenFlopShown and len(analyzer.flopActions) == 0)
            or (options.parseWhenFlopOnly and (len(analyzer.flopActions) == 0 or len(analyzer.turnActions) > 0))
            or (options.parseWhenTurnShown and len(analyzer.turnActions) == 0)
            or (options.parseWhenRiverShown and len(analyzer.riverActions) == 0)
            ):
           continue
         # Print
         else:
             handprinter = HandPrinter(analyzer, options.ignoreHeroBetSize, options.useSimpleNames, options.includeSiteName)
             parsedHistory = handprinter.printHand()
             parseResult.append((analyzer.handId, parsedHistory))
         
     return parseResult
Пример #3
0
 def parseHistoryTexts(self, historyTexts, ignoreBetSize, useSimpleNames, excludeNoHeroHH):
     """Parse list of input histories and return tuple list with hand id and parsed history"""
     
     parseResult = []
     
     for historyText in historyTexts:
         analyzer = TxtAnalyzer(historyText)
         analyzer.analyze()
         
         #exclude hand history without hero if option is active
         if((excludeNoHeroHH and analyzer.hero) or not excludeNoHeroHH):
             handprinter = HandPrinter(analyzer,ignoreBetSize, useSimpleNames)
             parsedHistory = handprinter.printHand()
             parseResult.append((analyzer.handId, parsedHistory))
         
     return parseResult
Пример #4
0
    def parseHandHistory(self, inputFile, outputFile):

        try:

            with open(inputFile) as file:
                history = file.read()
                analyzer = TxtAnalyzer(history)
                analyzer.analyze()

            handprinter = HandPrinter(analyzer, False, False)
            handprinter.printHandToFile(outputFile)

            print("Parsing successful")

        except AnalyzerException as e:
            print("Parsing failed")
            print("Error: ", e)
Пример #5
0
 def parseHandHistory(self, inputFile, outputFile):
     
     try:
         
         with open(inputFile) as file:
             history = file.read()
             analyzer = TxtAnalyzer(history)
             analyzer.analyze()
         
         handprinter = HandPrinter(analyzer,False,False)
         handprinter.printHandToFile(outputFile)    
         
         print("Parsing successful")
         
     except AnalyzerException as e:
         print("Parsing failed")
         print("Error: ",e)