Annotation Tools

class annotateEngine.Annotator(name: str, notifyFunction: Callable[[str], None] | None = None)[source]

A Annotator class applying

Parameters:
  • name – name of the annotation engine

  • notifyFunction – print-like function used for notification

__init__(name: str, notifyFunction: Callable[[str], None] | None = None) None[source]
setBlunder(score: float, addVariant: bool = True) None[source]

Sets the condition for a blunder move (NAG: $4)

Parameters:
  • score – score limit (score < 0 expected)

  • addVariant – add a variant in below score

setDubiousMove(score: float, addVariant: bool = False) None[source]

Sets the condition for a dubious move (NAG: $6)

Parameters:
  • score – score limit (score < 0 expected)

  • addVariant – add a variant in below score

setPoorMove(score: float, addVariant: bool = False) None[source]

Sets the condition for a poor move (NAG: $2)

Parameters:
  • score – score limit (score < 0 expected)

  • addVariant – add a variant in below score

setBrillantMove(score: float, addVariant: bool = False) None[source]

Sets the condition for a brilliant move (NAG: $3)

Parameters:
  • score – score limit (score > 0 expected)

  • addVariant – add a variant in below score

setSpeculativeMove(score: float, addVariant: bool = False) None[source]

Sets the condition for a speculative move (NAG: $5)

Parameters:
  • score – score limit (score > 0 expected)

  • addVariant – add a variant in below score

setGoodMove(score: float, addVariant: bool = False) None[source]

Sets the condition for a good move (NAG: $1)

Parameters:
  • score – score limit (score > 0 expected)

  • addVariant – add a variant in below score

static remove(game: Game, comments: bool = False, variants: bool = False) Game[source]

Remove certain items from a game

Parameters:
  • game – game to process

  • comments – If True, remove all comments

  • variants – If True, remove all variants

apply(game: ~chess.pgn.Game | ~chess.pgn.GameNode = <Game at 0x1f8af9d2650 ('?' vs. '?', '????.??.??')>, scoreListList: ~typing.List[~typing.List[float]] = [], pvListList: ~typing.List[~typing.List[~typing.List[~chess.Move]]] | None = None, forceHints: bool = False) bool[source]

Apply the results of AnnotateEngine.run to a game

Parameters:
  • game – game or gameNode where annotation starts (required)

  • scoreListList – for each move a list of scores for each variant, see AnnotateEngine.scoreListList

  • pvListList – for each move a list of lists of moves for each variant, see AnnotateEngine.pvListList

  • forceHints – force the creation of variants independent of the setXX definitions

Returns:

boolean indicating whether any hints are added

class annotateEngine.AnnotateEngine(notifyFunction: Callable[[str], None] | None = None, parent: QObject | None = None)[source]

A wrapper class collecting score and variant (pv) data from an engine

Parameters:

notifyFunction – print-like function used for notification

__init__(notifyFunction: Callable[[str], None] | None = None, parent: QObject | None = None) None[source]
setup(engine: ChessEngine, hintPLYs: int = 0, multiPV: int = 1) None[source]

Setup for operation

Parameters:
  • engine – engine used for annotation

  • hintPLYs – number of half moves (plys) in variants. Suppress hints by setting hintPLYs == 0

  • multiPV – number of variants

run(game: Game | GameNode, numberOfPlys: int | None = None) bool[source]

Runs the engine for a whole game or a gameNode

Parameters:
  • game – game or gameNode

  • numberOfPlys – number of half moves to analyse, None means analysis of the rest of the game

Returns:

True, if successful