CPT Community

Innovative Chess Training
Welcome to CPT Community Sign in | Join | Help
in Search

Help truncate pgn files to eco relative length with text editor.

Last post 04-25-2010, 5:06 by ladyhawk. 3 replies.
Sort Posts: Previous Next
  •  02-24-2010, 3:11 1463

    Help truncate pgn files to eco relative length with text editor.

    Hi,

    I want to truncate my repertoire in pgn format to eco relative lengt, for training purpose.

    I create a ctg book from my white repertoire database in chessbase, check the option eco relative lengt, and set zero for length.

    Then I open fritz, load the new created ctg book, open my white repertoire database in pgn format, select all the games and choose for blundercheck.

    The options in the blunder check window I set are, side to analyze: white, output: annotate as variations, storrage replace, depth: 3, Check main line: checked.

    Here is an examle of the pgn file after the blunder check.

    [Event "URS-ch47"]

    [Site "Minsk"]

    [Date "1979.12.??"]

    [Round "1"]

    [White "Carlsen, Magnus"]

    [Black "Giorgadze, Tamaz"]

    [Result "1-0"]

    [ECO "C24"]

    [WhiteElo "2545"]

    [BlackElo "2535"]

    [PlyCount "78"]

    [EventDate "1979.11.29"]

    [EventRounds "17"]

    [EventCountry "URS"]

    [EventCategory "12"]

    [Source "ChessBase"]

    [SourceDate "1999.07.01"]

    [WhiteTeam "Norway"]

    [BlackTeam "Venezuela"]

    [WhiteTeamCountry "NOR"]

    [BlackTeamCountry "VEN"]

    1. e4 e5 2. Nf3 {last book move} d6 3. Bc4 Be7 4. d3 Nf6 5. c3 O-O 6. O-O c6 7.

    Bb3 Be6 8. Bc2 h6 9. Re1 Nbd7 10. Nbd2 Qc7 11. d4 Rfe8 12. h3 Nf8 13. c4 Ng6

    14. d5 Bd7 15. Nb1 Bf8 16. Nc3 c5 17. Ba4 a6 18. Bxd7 Nxd7 19. g3 Be7 20. h4

    Nf6 21. Nh2 Qd7 22. a4 Qh3 23. Qf3 Qd7 24. a5 Nf8 25. Bd2 Rec8 26. Nf1 Ng4 27.

    Na4 Bd8 28. Rec1 Rab8 29. b4 cxb4 30. Bxb4 h5 31. Nb6 Bxb6 32. axb6 Qe7 33. Qa3

    Rd8 34. f3 Nh6 35. c5 dxc5 36. Bxc5 Qf6 37. Kg2 Re8 38. Be3 Nd7 39. Rab1 Qe7

    1-0

    [Event "Crete m rap"]

    [Site "Crete"]

    [Date "2003.09.23"]

    [Round "1"]

    [White "Carlsen, Magnus"]

    [Black "Azmaiparashvili, Zurab"]

    [Result "1-0"]

    [ECO "C41"]

    [WhiteElo "2830"]

    [BlackElo "2702"]

    [PlyCount "98"]

    [EventDate "2003.09.23"]

    [EventType "rapid"]

    [EventRounds "2"]

    [EventCountry "GRE"]

    [Source "ChessBase"]

    [SourceDate "1999.07.01"]

    [WhiteTeam "Norway"]

    [BlackTeam "Venezuela"]

    [WhiteTeamCountry "NOR"]

    [BlackTeamCountry "VEN"]

    1. e4 d6 2. d4 Nf6 3. Nc3 {last book move}

    I want to delete all the moves after {last book move}, so it looks similar to the line above. I have tried UltraEdit and EditPad pro, because they can handle large text files, and have some advanced search and replace options.

     

    I thought it would be possible with search and replace "{last book move}*" with "noting", but it doesn't seem to work that way.

    I also have tried the option no wrapping.

    Does someone know any other text editor that it may work with? And how exactly it has to be done?

    I hope someone can help me.

    Regards, Jonathan

  •  03-02-2010, 11:32 1469 in reply to 1463

    Re: Help truncate pgn files to eco relative length with text editor.

    I don't have a regex-capable editor on the PC I'm on now (so this is from memory and not tested), but with regular expressions turned on:

    \{last book move\}.*

     replaced with nothing should work with single-game files and multiple game files with a line break after each game while

    \{last book move\}.*?\[

     replaced with [ or maybe \[ should handle all but the last game of multiple game files without linebreaks.

     (The backslash (NOT frontslash / ) is needed to escape the square and curly brackets because they otherwise have special meanings in regex. The dot matches any character except linebreaks, the asterisk says match the preceding zero or more times, the ? means do the preceding multiple match the least number of times possible to get a match)

     

  •  03-06-2010, 3:52 1475 in reply to 1469

    Re: Help truncate pgn files to eco relative length with text editor.

    I have found a way to truncate the games with the search and replace tools of MS Word 2007.
    Here is how I did it, if someone is interested:

     

    First replace { with noting, and } with noting, (with use wildcards unchecked).


    Then replace 0-1^p with ^p, 1-0^p with ^p, and 1/2-1/2^p with ^p, ((whit ignore white-space characters checked, (select paragraph mark for ^p) ).


    Finally replace last*Event with^p^p[Event


    The problem is that the chess engine doesn't use the book moves all the time when blunderchecking games.
    Sometime the book has for example 12 ply's in a certain line, but the engine annotates the line after the third ply with, last book move.
    Maybe the engine would follow the book moves if the moves where all marked green, with the add priority analysis function of fritz, but that changes the length off the book, (an error which I reported to chessbase).  

     

    Regards, Jonathan

  •  04-25-2010, 5:06 1533 in reply to 1475

    Re: Help truncate pgn files to eco relative length with text editor.

    Replacing  last with * will do the trick to.

    It seems like the problem that the chess engine doesn't use the book moves all the time when blunderchecking games, seems to be solved with the latest update: http://www.fritzload.com/updates/gui12.exe
    You can set the depth to 1 and the threshold to 999 if you want the progress to go really fast.

    You also can cut the games before to 40 ply's, (an openings book from eco relative length doesn't go further then 40 ply's in most cases). 

     

View as RSS news feed in XML