Hi
Does someone know how it's possible to delete informant symbols in a big pgn file, only for one color, (white, or black moves).
I want to use it to filter out main lines from pgn files created with obk2pgn
"PGN Output
Each variation in the original OBK file is output as a separate game in the PGN file. Each move is annotated according to the book score: 3 = !!, 2 = !, 1 = , 0 = ? ."
Than I put a extra ! for one color, with lgpgnmw. Open the pgn in a text editor and delete al !!! annotations. Than I convert the pgn to cbh, and create a search booster. Than I remove the games with !!, !, and ?! in the annotation.
I will end up with only the main lines where chessmaster 9000 added 3 dots to the variation.
I hope someone can help me with that.
delete informant symbols for one color in pgn
Moderators: hgm, Rebel, chrisw
-
- Posts: 239
- Joined: Fri Jul 06, 2018 4:23 pm
- Full name: Jonathan Cremers
-
- Posts: 25
- Joined: Mon Dec 10, 2018 2:45 pm
- Full name: jack d.
-
- Posts: 239
- Joined: Fri Jul 06, 2018 4:23 pm
- Full name: Jonathan Cremers
Re: delete informant symbols for one color in pgn
Yes I have pgn-exract. I don't think it has an option to only delete comments for white (or black) moves. I know there is a option to delete all comments but that's not what I look for.
-
- Posts: 4833
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: delete informant symbols for one color in pgn
Could you post a sample game?Jonathan003 wrote: ↑Sat Feb 09, 2019 9:33 am Hi
Does someone know how it's possible to delete informant symbols in a big pgn file, only for one color, (white, or black moves).
-
- Posts: 239
- Joined: Fri Jul 06, 2018 4:23 pm
- Full name: Jonathan Cremers
Re: delete informant symbols for one color in pgn
This is how the output of obkpgn looks like for a white book.
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. Nf3? Nc6? 3. e4!! g6? 4. Bb5!! Bg7? 5. O-O!! d6? 6. Re1!! Bd7? 7.
a4!! Rc8? 8. d3!! Nf6? 9. Nd5!! O-O? 10. Bg5!! a6? 11. Bxf6!! exf6? 12. Bc4!!
f5? 13. c3!! fxe4? 14. dxe4!!
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. e4!! a6? 3. Nge2!! d6? 4. g3!! Nc6? 5. Bg2!! g6? 6. d3!! Bg7? 7.
Be3!! Nf6? 8. h3!! Bd7? 9. Qd2!! b5? 10. Bh6!! Bxh6? 11. Qxh6!! Nd4? 12. Nxd4!!
cxd4? 13. Ne2!! e5? 14. O-O!!
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. e4!! a6? 3. Nge2!! d6? 4. g3!! g6? 5. Bg2!! Nc6?
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. e4!! a6? 3. Nge2!! d6? 4. g3!! g6? 5. Bg2!! Bg7? 6. d4!! cxd4? 7.
Nxd4!! Nf6? 8. O-O!! O-O? 9. b3!! Nc6? 10. Nxc6!! bxc6? 11. Bb2!! Qa5? 12. Na4!!
Bg4? 13. Qe1!! Qh5? 14. f3!!
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. Nf3? Nc6? 3. e4!! g6? 4. Bb5!! Bg7? 5. O-O!! d6? 6. Re1!! Bd7? 7.
a4!! Rc8? 8. d3!! Nf6? 9. Nd5!! O-O? 10. Bg5!! a6? 11. Bxf6!! exf6? 12. Bc4!!
f5? 13. c3!! fxe4? 14. dxe4!!
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. e4!! a6? 3. Nge2!! d6? 4. g3!! Nc6? 5. Bg2!! g6? 6. d3!! Bg7? 7.
Be3!! Nf6? 8. h3!! Bd7? 9. Qd2!! b5? 10. Bh6!! Bxh6? 11. Qxh6!! Nd4? 12. Nxd4!!
cxd4? 13. Ne2!! e5? 14. O-O!!
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. e4!! a6? 3. Nge2!! d6? 4. g3!! g6? 5. Bg2!! Nc6?
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5? 2. e4!! a6? 3. Nge2!! d6? 4. g3!! g6? 5. Bg2!! Bg7? 6. d4!! cxd4? 7.
Nxd4!! Nf6? 8. O-O!! O-O? 9. b3!! Nc6? 10. Nxc6!! bxc6? 11. Bb2!! Qa5? 12. Na4!!
Bg4? 13. Qe1!! Qh5? 14. f3!!
-
- Posts: 239
- Joined: Fri Jul 06, 2018 4:23 pm
- Full name: Jonathan Cremers
Re: delete informant symbols for one color in pgn
I would like to delete only the comments for black moves in this file. So I wil be able to search for games with ? or ?! annotation for the white moves in chessbase.
-
- Posts: 239
- Joined: Fri Jul 06, 2018 4:23 pm
- Full name: Jonathan Cremers
Re: delete informant symbols for one color in pgn
I think I have find a solution. I first ad a extra ! to the black moves. Than I search for ?! in a text editor and remove them. I wonder if it can be done without lgpgnmw. Luckily I stil have a copy of it somewhere.
-
- Posts: 4833
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: delete informant symbols for one color in pgn
Try this move annotation modifierJonathan003 wrote: ↑Sun Feb 10, 2019 7:25 pm I would like to delete only the comments for black moves in this file. So I wil be able to search for games with ? or ?! annotation for the white moves in chessbase.
Sample run:
Code: Select all
enter pgn filename? sample.pgn
enter color of move annotation to be removed (w/b) ? b
Done, see output file out_sample.pgn
Press any key to exit
Place your pgn file in the same dir with the move anno exe file
Sample output from your posted pgn file.
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5 2. Nf3? Nc6 3. e4!! g6 4. Bb5!! Bg7 5. O-O!! d6 6. Re1!! Bd7 7. a4!! Rc8 8. d3!! Nf6 9. Nd5!! O-O 10. Bg5!! a6 11. Bxf6!! exf6 12. Bc4!! f5 13. c3!! fxe4 14. dxe4!! 1/2-1/2
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "-"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
1. Nc3 c5 2. e4!! a6 3. Nge2!! d6 4. g3!! Nc6 5. Bg2!! g6 6. d3!! Bg7 7. Be3!! Nf6 8. h3!! Bd7 9. Qd2!! b5 10. Bh6!! Bxh6 11. Qxh6!! Nd4 12. Nxd4!! cxd4 13. Ne2!! e5 14. O-O!! 1/2-1/2
This program is using the python-chess lib from https://github.com/niklasf/python-chess
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: delete informant symbols for one color in pgn
Here's a hacked-together Perl implementation:
That removes markings for black. If you want to remove markings for white, use "if ($wtm == 1)". No guarantees, but it seems to work in the example you posted.
Code: Select all
cat kk.pgn | perl -ne '
if (/^\[/ || /^$/) {print; next;}
for $token (split " ", $_) {
if ($token =~ /^[1-9]/) {$wtm = 1; print "$token "; next;}
if ($wtm == 0) {$token =~ s/[!\?]//g;}
print "$token ";
$wtm = 1-$wtm;
}
print "\n"
'
-
- Posts: 239
- Joined: Fri Jul 06, 2018 4:23 pm
- Full name: Jonathan Cremers
Re: delete informant symbols for one color in pgn
Thanks Ferdy for the tool move annotation modifier.
It works great!
Also thanks for the Perl implementation Alvaro. But I have no experience with Perl implementation.
It works great!
Also thanks for the Perl implementation Alvaro. But I have no experience with Perl implementation.
Last edited by Jonathan003 on Thu Feb 14, 2019 11:49 am, edited 1 time in total.