Merging SGFs
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Merging SGFs
Greetings,
How can I merge a fairly large quantity of sgfs (tsumego probs) into one sgf file?
The reason I ask, is that I recently tried to view single files of Carl Jung's 440 problems on wegoigo on an android phone, and it didn't work so well, and then I installed the merged files which he had at some point made available, and they worked like a charm, so now I would like to try that with some other files as well.
Thanks.
How can I merge a fairly large quantity of sgfs (tsumego probs) into one sgf file?
The reason I ask, is that I recently tried to view single files of Carl Jung's 440 problems on wegoigo on an android phone, and it didn't work so well, and then I installed the merged files which he had at some point made available, and they worked like a charm, so now I would like to try that with some other files as well.
Thanks.
Patience, grasshopper.
-
Kirby
- Honinbo
- Posts: 9553
- Joined: Wed Feb 24, 2010 6:04 pm
- GD Posts: 0
- KGS: Kirby
- Tygem: 커비라고해
- Has thanked: 1583 times
- Been thanked: 1707 times
Re: Merging SGFs
A variation is enclosed in parentheses. After the root with basi info (only have one root), you can see the main variation in parentheses. Subvariations are in subparentheses.
To merge another sgf from move 1, just copy that big set of text after the root including parentheses, and paste it after the closing parenthesis of the original file.
If this is confusing, this page may clarify:
http://www.red-bean.com/sgf/sgf4.html
In particular, pretend move A in the first diagram is the first move in your first sgf. Move F can be move 1 from your second sgf. You can see the general pattern that, when a new variation comes up, use parentheses to delimit them.
To merge another sgf from move 1, just copy that big set of text after the root including parentheses, and paste it after the closing parenthesis of the original file.
If this is confusing, this page may clarify:
http://www.red-bean.com/sgf/sgf4.html
In particular, pretend move A in the first diagram is the first move in your first sgf. Move F can be move 1 from your second sgf. You can see the general pattern that, when a new variation comes up, use parentheses to delimit them.
be immersed
- tchan001
- Gosei
- Posts: 1582
- Joined: Wed Apr 21, 2010 6:44 pm
- GD Posts: 1292
- Location: Hong Kong
- Has thanked: 54 times
- Been thanked: 534 times
- Contact:
Re: Merging SGFs
Maybe try multigo4
File >> Import Files as Branch
File >> Import Files as Branch
http://tchan001.wordpress.com
A blog on Asian go books, go sightings, and interesting tidbits
Go is such a beautiful game.
A blog on Asian go books, go sightings, and interesting tidbits
Go is such a beautiful game.
- CnP
- Lives in gote
- Posts: 438
- Joined: Tue May 25, 2010 3:25 pm
- Rank: 5k DGS
- GD Posts: 100
- Has thanked: 85 times
- Been thanked: 85 times
Re: Merging SGFs
I used one of Carl Jung's converters on a set by goplayer2006 on ebay. To combine the sgf files into a single file I found it very easy. I use Ubuntu and I used the 'cat' command to create a single file (actually a number of files one for each difficulty level) that just contained the others. Gogrinder on my android phone took the new file fine. I think weigoigo had problems with it because my phone is cheap and ran out of memory but Gogrinder seems to manage it's memory differently and was okay (these were files with 1000 problems in each). Since they're simple ascii files you can open them up in your favourite text editor anyway.
I am John. John-I-Am.
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Re: Merging SGFs
@Kirby- since I want to merge hundreds of files, pasting them one by one seems impractical.
@TChan - thanks, that was quite easy. Unfortunately, Wegoigo opens the file, but incorrectly - wegoigo does not show the preview, and instead shows a blank board. I don't know if this is because of Wegoigo or Multigo, but CGoban won't open them either, complaining of a "redundant rule specification."
@CnP I couldn't find Carl Jung's tool. It doesn't seem to be listed here: viewtopic.php?f=18&t=637&start=0
@TChan - thanks, that was quite easy. Unfortunately, Wegoigo opens the file, but incorrectly - wegoigo does not show the preview, and instead shows a blank board. I don't know if this is because of Wegoigo or Multigo, but CGoban won't open them either, complaining of a "redundant rule specification."
@CnP I couldn't find Carl Jung's tool. It doesn't seem to be listed here: viewtopic.php?f=18&t=637&start=0
Patience, grasshopper.
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Re: Merging SGFs
Sensei's library points to this sgf merger: http://www.igoweb.org/~wms/comp/sgfMerger/
but the page blithly says:
I'm not computer-savvy enough to be able to figure out how to do this.
but the page blithly says:
To use it, just run the .jar file as a command line application, with the input SGF files as arguments. It will emit merge.sgf. For example, on Unix you would type:
$ java -jar sgfMerge.jar x.sgf y.sgf z.sgf
On Windows or Mac systems, I'm not sure exactly how to do the same thing, but it should be possible
I'm not computer-savvy enough to be able to figure out how to do this.
Patience, grasshopper.
-
Bill Spight
- Honinbo
- Posts: 10905
- Joined: Wed Apr 21, 2010 1:24 pm
- Has thanked: 3651 times
- Been thanked: 3373 times
Re: Merging SGFs
daal wrote:Sensei's library points to this sgf merger: http://www.igoweb.org/~wms/comp/sgfMerger/
but the page blithly says:To use it, just run the .jar file as a command line application, with the input SGF files as arguments. It will emit merge.sgf. For example, on Unix you would type:
$ java -jar sgfMerge.jar x.sgf y.sgf z.sgf
On Windows or Mac systems, I'm not sure exactly how to do the same thing, but it should be possible
I'm not computer-savvy enough to be able to figure out how to do this.
Open a terminal, console, or DOS window -- whatever your system calls it -- and navigate to the folder or directory where the sgf files are. I think that the command to do that is cd {directory} for Windows, Macs, and Linux. (CD = change directory
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins
Visualize whirled peas.
Everything with love. Stay safe.
At some point, doesn't thinking have to go on?
— Winona Adkins
Visualize whirled peas.
Everything with love. Stay safe.
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Re: Merging SGFs
Thanks Bill, but I haven't managed to get farther than opening a command window. Everything I've typed into it so far has resulted in a dos version of a sceptically raised eyebrow.
The sgfs are located in a folder called "tsumego" located at the top level of the partition "D." Can you or anyone else tell me exactly what to type in the command window, and whether I have to type the name of each sgf?
The sgfs are located in a folder called "tsumego" located at the top level of the partition "D." Can you or anyone else tell me exactly what to type in the command window, and whether I have to type the name of each sgf?
Patience, grasshopper.
-
Kirby
- Honinbo
- Posts: 9553
- Joined: Wed Feb 24, 2010 6:04 pm
- GD Posts: 0
- KGS: Kirby
- Tygem: 커비라고해
- Has thanked: 1583 times
- Been thanked: 1707 times
Re: Merging SGFs
daal wrote:Thanks Bill, but I haven't managed to get farther than opening a command window. Everything I've typed into it so far has resulted in a dos version of a sceptically raised eyebrow.
The sgfs are located in a folder called "tsumego" located at the top level of the partition "D." Can you or anyone else tell me exactly what to type in the command window, and whether I have to type the name of each sgf?
Type "D:" without quotes to get to the D: drive, prior to using any "cd" command.
be immersed
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Re: Merging SGFs
Kirby wrote:daal wrote:Thanks Bill, but I haven't managed to get farther than opening a command window. Everything I've typed into it so far has resulted in a dos version of a sceptically raised eyebrow.
The sgfs are located in a folder called "tsumego" located at the top level of the partition "D." Can you or anyone else tell me exactly what to type in the command window, and whether I have to type the name of each sgf?
Type "D:" without quotes to get to the D: drive, prior to using any "cd" command.
Thanks, but after typing d in the command module and pressing enter, something appears to the effect of: "The command 'd' is either written wrong or could not be found."
But even if I got to "D," I still need someone to explain how to "navigate" to the folder and what exactly to type.
Thanks.
edit: Here we see demonstrated the failure to impart due importance to little things such as colons.
Last edited by daal on Sat Dec 31, 2011 6:24 am, edited 1 time in total.
Patience, grasshopper.
-
Kirby
- Honinbo
- Posts: 9553
- Joined: Wed Feb 24, 2010 6:04 pm
- GD Posts: 0
- KGS: Kirby
- Tygem: 커비라고해
- Has thanked: 1583 times
- Been thanked: 1707 times
Re: Merging SGFs
daal wrote:Kirby wrote:daal wrote:Thanks Bill, but I haven't managed to get farther than opening a command window. Everything I've typed into it so far has resulted in a dos version of a sceptically raised eyebrow.
The sgfs are located in a folder called "tsumego" located at the top level of the partition "D." Can you or anyone else tell me exactly what to type in the command window, and whether I have to type the name of each sgf?
Type "D:" without quotes to get to the D: drive, prior to using any "cd" command.
Thanks, but after typing d in the command module and pressing enter, something appears to the effect of: "The command 'd' is either written wrong or could not be found."
But even if I got to "D," I still need someone to explain how to "navigate" to the folder and what exactly to type.
Thanks.
Ok. Go to the start menu, and select run. Type:
cmd
This should open up a command window. The next thing to check is if the java executable - you probably have it - is in the classpath. In other words, you can see if you can execute the java command without specifying the directory. To do that, in the command window, type:
java -version
Just typing:
java
could work to. Confirmthat the command is found.
Assuming java is found, to make things easier on you, simply look at the directory the cmd window is open to. In windows explorer, copy the jar file you downloaded and all sgfs to that directory.
After this, back in the cmd window, type:
java -jar sgfMerge.jar x.sgf y.sgf z.sgf
where x, y, and z are the sgf filenames you want to merge. If you have more than three sgf files, just keep appending more arguments after z.sgf.
If you could not find java, above, let me know, and we can discuss more from there.
be immersed
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Re: Merging SGFs
Thanks Kirby. I found java, but when I ran the command, I got "unable to access jarfile sgfMerge.jar...ah, because it's called sgfMerger..x.x back to typing...
Hm. That brought up: "Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to read type -5
at org.igoweb.go.sgf.FileIo.parseParam<FileIo.java:635
at org.igoweb.go.sgf.FileIo.readNode<fileIo.java:349>
at org.igoweb.go.sgf.FileIo.readSgf<FileIo.java:299>
at org.igoweb.go.sgf.FileIo.<Init><FileIo.java:244>
at org.igoweb.sgfMerger.SgfMerger.main<SgfMerger.java:29>
Oh bother. This is too much typing anyway. I have hundreds of tsumego files, and this would take forever to type in all the names. There isn't an easier way?
Hm. That brought up: "Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to read type -5
at org.igoweb.go.sgf.FileIo.parseParam<FileIo.java:635
at org.igoweb.go.sgf.FileIo.readNode<fileIo.java:349>
at org.igoweb.go.sgf.FileIo.readSgf<FileIo.java:299>
at org.igoweb.go.sgf.FileIo.<Init><FileIo.java:244>
at org.igoweb.sgfMerger.SgfMerger.main<SgfMerger.java:29>
Oh bother. This is too much typing anyway. I have hundreds of tsumego files, and this would take forever to type in all the names. There isn't an easier way?
Patience, grasshopper.
-
Kirby
- Honinbo
- Posts: 9553
- Joined: Wed Feb 24, 2010 6:04 pm
- GD Posts: 0
- KGS: Kirby
- Tygem: 커비라고해
- Has thanked: 1583 times
- Been thanked: 1707 times
Re: Merging SGFs
daal wrote:Thanks Kirby. I found java, but when I ran the command, I got "unable to access jarfile sgfMerge.jar...ah, because it's called sgfMerger..x.x back to typing...
Hm. That brought up: "Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to read type -5
at org.igoweb.go.sgf.FileIo.parseParam<FileIo.java:635
at org.igoweb.go.sgf.FileIo.readNode<fileIo.java:349>
at org.igoweb.go.sgf.FileIo.readSgf<FileIo.java:299>
at org.igoweb.go.sgf.FileIo.<Init><FileIo.java:244>
at org.igoweb.sgfMerger.SgfMerger.main<SgfMerger.java:29>
Oh bother. This is too much typing anyway. I have hundreds of tsumego files, and this would take forever to type in all the names. There isn't an easier way?
I'll tell you what... I don't know much about the jar file - I even made a typo in the name. Sorry about that. Zinstead of this hassle, I'll just write up a script and pm it to you. It'll take a few minutes, but I'll send you something ina bit.
be immersed
-
kivi
- Lives with ko
- Posts: 159
- Joined: Mon Mar 21, 2011 7:14 am
- Rank: EGF 3d
- GD Posts: 0
- Has thanked: 5 times
- Been thanked: 36 times
Re: Merging SGFs
Edit: This is for windows (but other systems almost same, so do say what you have if not windows).
You can right click on the tsumego folder while holding the shift key, and select "open command prompt here".
Into command prompt type the following.
"type" echoes what is inside a file (similar to "cat" in linux).
This will copy the content of all sgf files in that folder into a new file named merged.sgf in the upper folder (of course you can use a better name for the new file).
WARNING: If the output file (merged.sgf) already exists, then it will be overwritten.
You can right click on the tsumego folder while holding the shift key, and select "open command prompt here".
Into command prompt type the following.
Code: Select all
type *.sgf > ..\merged.sgf"type" echoes what is inside a file (similar to "cat" in linux).
This will copy the content of all sgf files in that folder into a new file named merged.sgf in the upper folder (of course you can use a better name for the new file).
WARNING: If the output file (merged.sgf) already exists, then it will be overwritten.
- daal
- Oza
- Posts: 2508
- Joined: Wed Apr 21, 2010 1:30 am
- GD Posts: 0
- Has thanked: 1304 times
- Been thanked: 1128 times
Re: Merging SGFs
Thanks to all for your assistance. Strangely, even kivi's method didn't work on my computer right away (shift right click didn't offer the option "open command prompt here") But since the solution seemed promising, I did figure out enough about navigating in the command window to get to the file where the tsumegos were. Here I'll tell anyone noobier than me how to do it:
Now it's time to move on to the next roadblock: how to modify the problems so that the apps recognize the solutions...
Now it's time to move on to the next roadblock: how to modify the problems so that the apps recognize the solutions...
Patience, grasshopper.