Tool for converting PGN to EPD for analysis.

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
reflectionofpower
Posts: 1653
Joined: Fri Mar 01, 2013 5:28 pm
Location: USA

Tool for converting PGN to EPD for analysis.

Post by reflectionofpower »

I need utility for converting PGN into EPD. In other words have a bunch of games in PGN and then have all them as EPD at their end positions.

ANd then be able to analyze them. COuld I do this is process set in Deep Fritz 14? How come process set is in CBH format or did I miss something?
"Without change, something sleeps inside us, and seldom awakens. The sleeper must awaken." (Dune - 1984)

Lonnie
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Tool for converting PGN to EPD for analysis.

Post by Adam Hair »

PGN Extract - http://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/
epdFin - http://www.hoflink.com/~npollock/chess.html
readme-EPD.txt wrote:=======================(6) epdFin ================================

"epdFin" is used in combination with the excellent utility tool
"PGN-Extract" by David Barnes. Together they input a "pgn" file and
output an "epd" file containing a user-specified number of records
from the end of each game. The default is 1 record.

See "Auxiliary Software" above for "PGN-Extract" download information.

First, "PGN-Extract" outputs an intermediate "epd" file, which
contains all the positions encountered in the input "pgn" file. It
uses a blank line to separate successive games.

Second, "epdFin" inputs the intermediate "epd" file and outputs the
last record(s) of each game to "outF.epd".

"epdFin" can be considered a reverse truncation program because it
keeps records from the end of the games.

The number of records is one more that the number of plies (half-
moves). For example, 8 records will result in 7 plies (half-moves).

By using the output file "outF.epd", the user can step through the
final positions of each game. See the instructions above for
"Winboard" on how to step through a game in an "epd" file.

Using the default value of 1 will result in "outF.epd" containing
just the final record of each game. This in turn can be used by
"epdList" to see which games end in the same position.

If a game has fewer records than the user-specified "record_number",
then all its records will be output.

If 2 or more records from the end of each game are requested, then
the output file inserts a blank line between each output set.

Because "epdFin" requires two programs to be executed successively,
a batch file (script) may be used for convenience. See the comments
below for an example.

"epdFin" can also be used on its own, but you have to be sure that
the input "epd" file does not have any blank lines at the start, has
exactly one blank line between games and has at most one blank line
at the end of the last game.

Usage: PGN-Extract -Wepd -s -otemp.epd filename.pgn

epdFin temp.epd [record_number]

Example: PGN-Extract -Wepd -s -otemp.epd alpha.pgn

epdFin temp.epd

Example: PGN-Extract -Wepd -s -otemp.epd alpha.pgn

epdFin temp.epd 10

Output: outF.epd

Comments:

1. Because using two programs in succession is demanding, you
might want to use a batch file (script). You can copy and
paste the following code into a text editor, and save it
with the name "pgn2Fin.bat":

PGN-Extract -Wepd -s -otemp.epd %1
epdFin temp.epd %2

Usage: pgn2Fin beta.pgn [record_number]

Example: pgn2Fin beta.pgn

Example: pgn2Fin beta.pgn 5

2. "temp.epd" ends with a blank line and has a blank line
between each game. It is essential that all the blank lines
stay as they are.

3. The intermediate file "temp.epd" can be very large.

4. Thanks to Roger Brown for his valuable suggestions.
Ferdy
Posts: 4848
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Tool for converting PGN to EPD for analysis.

Post by Ferdy »

reflectionofpower wrote:I need utility for converting PGN into EPD. In other words have a bunch of games in PGN and then have all them as EPD at their end positions.
reflectionofpower wrote: ANd then be able to analyze them. COuld I do this is process set in Deep Fritz 14? How come process set is in CBH format or did I miss something?
You can create a database in cbh format, then save the epd file to it.
Those epd files with bm or best move field can be used as a test sets for engines.
Games from pgn files can also be saved to that kind of database.

Extracting the last position of every game, saving those to epd file, then save it to cbh database, you can analyze this, but you can not use it as test sets because it has no bm field as in,

Code: Select all

r4rk1/ppq2ppp/1b2b3/nP6/3p4/2P2N2/P3QPPP/RNBR2K1 w - - bm Nxd4; id 1; c0 "Sample epd"
User avatar
reflectionofpower
Posts: 1653
Joined: Fri Mar 01, 2013 5:28 pm
Location: USA

Re: Tool for converting PGN to EPD for analysis.

Post by reflectionofpower »

Ferdy wrote:
reflectionofpower wrote:I need utility for converting PGN into EPD. In other words have a bunch of games in PGN and then have all them as EPD at their end positions.
reflectionofpower wrote:
You can create a database in cbh format, then save the epd file to it.
Those epd files with bm or best move field can be used as a test sets for engines.
Games from pgn files can also be saved to that kind of database.

Extracting the last position of every game, saving those to epd file, then save it to cbh database, you can analyze this, but you can not use it as test sets because it has no bm field as in,

Code: Select all

r4rk1/ppq2ppp/1b2b3/nP6/3p4/2P2N2/P3QPPP/RNBR2K1 w - - bm Nxd4; id 1; c0 "Sample epd"
I saw that part of making a CBH file but it looks like to me that if you have 200 positions in a EPD file you have to load position (copy.paste :.( ) Then save each one in that CBH file??? That's tedious and time consuming.

I want to have a PGN file, process all the games at the end of said games and have all these in an EPD file so I can analyze them ALL in one shot.

I know I am missing something here on my end because I never really worked with processing EPD files as much so bear with me.
"Without change, something sleeps inside us, and seldom awakens. The sleeper must awaken." (Dune - 1984)

Lonnie
Ferdy
Posts: 4848
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Tool for converting PGN to EPD for analysis.

Post by Ferdy »

reflectionofpower wrote: I saw that part of making a CBH file but it looks like to me that if you have 200 positions in a EPD file you have to load position (copy.paste :.( ) Then save each one in that CBH file??? That's tedious and time consuming.
There is a best way to import files, see below. In F13 open the cbh file then click that ribbon.

Image

reflectionofpower wrote: I want to have a PGN file, process all the games at the end of said games and have all these in an EPD file so I can analyze them ALL in one shot.
F13 (the one I am using) will not analyze a position without a move. So importing a position from epd file without bm will be of no use.
May I know exactly what is your purpose of doing like this?
User avatar
reflectionofpower
Posts: 1653
Joined: Fri Mar 01, 2013 5:28 pm
Location: USA

Re: Tool for converting PGN to EPD for analysis.

Post by reflectionofpower »

Ferdy wrote:
reflectionofpower wrote: I saw that part of making a CBH file but it looks like to me that if you have 200 positions in a EPD file you have to load position (copy.paste :.( ) Then save each one in that CBH file??? That's tedious and time consuming.
There is a best way to import files, see below. In F13 open the cbh file then click that ribbon.

Image

reflectionofpower wrote: I want to have a PGN file, process all the games at the end of said games and have all these in an EPD file so I can analyze them ALL in one shot.
F13 (the one I am using) will not analyze a position without a move. So importing a position from epd file without bm will be of no use.
May I know exactly what is your purpose of doing like this?
M on FICS and their adjudication system takes an extremely long time so I figured I might give them a better way. They must be doing one game at a time?
"Without change, something sleeps inside us, and seldom awakens. The sleeper must awaken." (Dune - 1984)

Lonnie
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Tool for converting PGN to EPD for analysis.

Post by Dann Corbit »

pgn2fen from here (I use it all the time with -e -l to give Epd format and include the leaf nodes):
http://www.7sun.com/chess/

pgn2epd from here:
http://remi.coulom.free.fr/

There are others.
User avatar
reflectionofpower
Posts: 1653
Joined: Fri Mar 01, 2013 5:28 pm
Location: USA

Re: Tool for converting PGN to EPD for analysis.

Post by reflectionofpower »

Dann Corbit wrote:pgn2fen from here (I use it all the time with -e -l to give Epd format and include the leaf nodes):
http://www.7sun.com/chess/

pgn2epd from here:
http://remi.coulom.free.fr/

There are others.
M doing pgn2fen test.pgn -e - l test.epd and nothing happens in command mode?
"Without change, something sleeps inside us, and seldom awakens. The sleeper must awaken." (Dune - 1984)

Lonnie
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Tool for converting PGN to EPD for analysis.

Post by Dann Corbit »

reflectionofpower wrote:
Dann Corbit wrote:pgn2fen from here (I use it all the time with -e -l to give Epd format and include the leaf nodes):
http://www.7sun.com/chess/

pgn2epd from here:
http://remi.coulom.free.fr/

There are others.
M doing pgn2fen test.pgn -e - l test.epd and nothing happens in command mode?
Hard for me to say what is happening for you. Works fine for me.

Code: Select all

Q:\>dir baracuda.pgn
 Volume in drive Q is File Repository
 Volume Serial Number is 5476-3CD2

 Directory of Q:\

2014-11-13  03:55 PM           113,246 baracuda.pgn
               1 File(s)        113,246 bytes
               0 Dir(s)  26,786,541,568 bytes free

Q:\>pgn2fen baracuda.pgn -e -l > baracuda.epd
Error loading PGN: Error: Line 5157: Unexpected End-of-file

Q:\>type baracuda.epd |leaf|sort|uniq> baracudal.epd

Q:\>tail baracudal.epd
rnbqk2r/ppb2ppp/2p1pn2/8/1PPP4/P1N5/5PPP/R1BQKBNR w KQkq - fmvn 9; hmvc 1;
rnbqk2r/ppp2pp1/4p2p/3pP3/3P4/2n5/P1P2PPP/R1BQKBNR w KQkq - fmvn 9; hmvc 0;
rnbqkb1r/1p2pp2/p2p3p/6p1/3NP1nB/2N5/PPP2PPP/R2QKB1R w KQkq - fmvn 9; hmvc 0;
rnbqkb1r/1p3ppp/p2ppn2/6B1/3NP3/2N5/PPP2PPP/R2QKB1R w KQkq - fmvn 9; hmvc 0;
rnbqkb1r/6pp/p2ppn2/1Np5/1pP5/P4N2/1P2PPPP/R1BQKB1R w KQkq - fmvn 9; hmvc 0;
rnbqkb1r/p4p2/2p1pn1p/1p4p1/2pPP3/2N2NB1/PP3PPP/R2QKB1R w KQkq - fmvn 9; hmvc 0;
rnbqkb1r/p4ppp/2p1p3/3nP3/PpBP4/8/NP3PPP/R1BQK1NR w KQkq - fmvn 9; hmvc 1;
rnbqkb1r/pp3pp1/4pn1p/6B1/3N4/2N5/PP2PPPP/R2QKB1R w KQkq - fmvn 9; hmvc 0;
rnbqr1k1/ppp2ppp/3p1n2/4p3/2PPP3/2PB1N2/P4PPP/R1BQK2R w KQ - fmvn 9; hmvc 1;
rnbr2k1/ppp1qppp/4pn2/3p4/2PP4/5NP1/PP1QPPBP/RN3RK1 w - - fmvn 9; hmvc 2;

Q:\>
I always get the message:
"Error loading PGN: Error: Line 5157: Unexpected End-of-file"
for any PGN file.
It can be safely ignored, as the last PGN move is always included in the output file.
Ferdy
Posts: 4848
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Tool for converting PGN to EPD for analysis.

Post by Ferdy »

reflectionofpower wrote: M on FICS and their adjudication system takes an extremely long time so I figured I might give them a better way. They must be doing one game at a time?
If you just want the end position analyzed, there is no need to use F13/F14, I can create a tool to extract end position of every game in a pgn then analyzed those positions using an engine, then those positions that are winning or losing by a given score threshold can be separated for example.
As Dann mentioned I also use pgn2fen to get the fen or epd, then scan it to get the last position of every game.