Life In 19x19
http://www.lifein19x19.com/

How to transform bunch of 13x13 SGFs into 19x19
http://www.lifein19x19.com/viewtopic.php?f=18&t=10963
Page 1 of 1

Author:  kupus [ Tue Oct 21, 2014 8:32 pm ]
Post subject:  How to transform bunch of 13x13 SGFs into 19x19

Hi,

I have a bunch of (problem) SGFs done on 13x3 board and they should be 19x19.

Is there an app that can transform them from 13x13 to 19x19, fast and easy way (like, bulk option)?

Many thanks

Author:  EdLee [ Tue Oct 21, 2014 9:05 pm ]
Post subject: 

Hi kupus, I don't know of any Go app that can do this in bulk.
If you're on Unix or some other OS, you may be able to write
a simple script to replace all the SZ[13] in the SGF to SZ[19] --
I think that may do it. Maybe there are freeware apps for
all the popular platforms that do this simple ASCII text substitution.

Curious: if all the problems fit on 13x13, why move to 19x19 ?
( I can imagine trying to save toner ink for all the :black: stones. )

Good luck.

Author:  oca [ Tue Oct 21, 2014 11:29 pm ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

Hi kupus,

Edlee's proposition to change the SZ attribute will work if your problems are in the lower left corner. if not, like this for example :

Click Here To Show Diagram Code
[go]$$Bc13 Black to kill
$$ ----------------+
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . . . . . X O . |
$$ . . . . , . X . |
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . , . . . . . . |[/go]


you will need to fix the moves too...

Author:  RobertJasiek [ Wed Oct 22, 2014 1:00 am ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

1) Use a software or text editor with replacement or regular expressions capability applied to all files in a directory (tree). Replace SZ[13] by SZ[19].

2) Open each file in a go editor (such as GoWrite), mark a region and shift that region.

I do not know if there is a simpler way for (2), but you might wish to check every SGF anyway, because some configurations you might want to leave in the corner, others move to the center.

Author:  kupus [ Wed Oct 22, 2014 11:19 am ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

Thank you all for your input.

The reason for changing from 13x13 to 19x19 is -

I have bunch of problems (lower left corner) that I want to export to doc/pdf using Drago. Then, if 13x13 is used hoshis are not in the proper place (as for 19x19 board). I can either
a) dont pay attention to hoshis
b) export without hoshis

I played with renaming *.sgf -> *.txt, then renaming sz[13] -> sz[19] with TextCrawler, but then stones are shifted up, they are not in the lower right corner.

So looks to me that there is no easy fix.

Thanks again, much appreciated

Author:  oca [ Wed Oct 22, 2014 1:46 pm ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

kupus wrote:
Thank you all for your input.

The reason for changing from 13x13 to 19x19 is -

I have bunch of problems (lower left corner) that I want to export to doc/pdf using Drago. Then, if 13x13 is used hoshis are not in the proper place (as for 19x19 board). I can either
a) dont pay attention to hoshis
b) export without hoshis

I played with renaming *.sgf -> *.txt, then renaming sz[13] -> sz[19] with TextCrawler, but then stones are shifted up, they are not in the lower right corner.

So looks to me that there is no easy fix.

Thanks again, much appreciated


I think I can help you. could you post a sample sgf ?
I can write transformation the script for you.

Author:  kupus [ Thu Oct 23, 2014 11:12 am ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

Thanks oca, just sent you a PM

Author:  oca [ Thu Oct 23, 2014 11:47 am ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

got it.

in sgf, the position "aa" means is left/top
like this :


Click Here To Show Diagram Code
[go]$$Bc
$$ ----------------
$$ | X . . . . . .
$$ | . . . . . . .
$$ | . . . . . . .
$$ | . . . , . . .
$$ | . . . . . . .
$$ | . . . . . . .
$$ | . . . . . . .[/go]


So when the tsumego is in the bottom left corner the sgf coordonate is not the same on a 13x13 and on a 19x19, that's why changing the SZ property don't work...

Click Here To Show Diagram Code
[go]$$Bc
$$ +---------------------------+
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . |
$$ +---------------------------+[/go]


on a 13x13, :b1: is position "am"


Click Here To Show Diagram Code
[go]$$Bc
$$ +---------------------------------------+
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | Y . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . . . . . . . |
$$ +---------------------------------------+[/go]


on a 19x19, :b1: is position "as", (and "am" leads to :bt: )

I will now fix your files now. not sur I can keep the comments as the encoding seems to be a problem for my computer...

Code:
C[¡¡¡¡Èçͼ1£¬ºÚÆåÐèÒª³Ôµô°×ÆåµÄÆå½î£¬ºÚ1ÊÇÕ÷³Ô£¬Ö®ºóºÚÆå²½²½½Ð³Ô£¬²¢ÇÒÇÉÃîµØ±Ü¹ý°×ÆåÍâΧµÄÆå×Ó£¬Õâ¸ö¹ý³Ì¾ÍÊÇÕ÷³Ô£¬ËäÈ»¹ý³ÌºÜ³¤£¬µ«²¢²»¸´ÔÓ¡£]

weird comment is it ;)

Author:  kupus [ Thu Oct 23, 2014 12:15 pm ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

many thanks.

comments are really not important as they are in chinese

Author:  oca [ Sat Oct 25, 2014 1:21 am ]
Post subject:  Re: How to transform bunch of 13x13 SGFs into 19x19

Here is the "groovy" script I used to fix the files, unfortunatly I had to remove the comments :

Code:
new File($/F:\Tesuji Specialized Training (From Shodan to 3d) SGF - Copie/$).eachFileRecurse { f->
   if (f.toString().endsWith(".sgf")) {
      def content =  f.getText();
      def replaced = content
         .replace("SZ[13]","SZ[19]")
         .replaceAll(/C[^\]]*/,"C[")
         .replaceAll(/\[[a-z]{2}\]/, {  match ->
            int positionToFix = match[2].charAt(0)
            int fixedCoord = positionToFix + 6
            def fixedLetter = ((char)fixedCoord)
            match[0..1]+fixedLetter+"]"
         } )
      
      f.write(replaced)
   }
}

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/