[sword-devel] Help converting text to imp

Greg Hellings greg.hellings at gmail.com
Wed Jun 15 08:18:28 MST 2011


Python could also easily be used. Not that this would work, but here's
the skeleton code

import fileinput
import Sword

mgr = Sword.SWMgr()
mod = mgr.getModule('KJV')
key = mod.getKey()
for line in fileinput.input():
  print "$$$%s\n%s" % (key.toString(), line)
  key.increment()

I forget the exact method call that converts a key into its string
representation, but it's something like that.  You then would execute
the above script like so:

./convert.py test.vpl

and its output should be in imp format.

--Greg

On Wed, Jun 15, 2011 at 10:06 AM, Peter von Kaehne <refdoc at gmx.net> wrote:
> You could do following:
>
> 1) create a sheet in your favourite spreadsheet.
>
> 2) add the output of diatheke with a KJV module into it, so that column 1 has teh references, column 2 the text. You do this by importing the diatheke output as CSV and choose your delimiting character carefully.
>
> 3) You drop the text column.
>
> 4) You add your text as a column
>
> 5) you run up and down the text to ensure that the text is correctly lined up.
>
> 6) You export as a CSV file, choosing a decent delimiter again - e.g. a colon.
>
> 7) You rename the csv file into a text file (this is optional)
>
> Then you run a version of  the sed script Karl gave you.
>
> All of the above could be done a lot faster and with less effort via a few lines of Perl, but I guess the recommendations above are at the level you are comfortable to work at.
>
> Peter
>
>
>
> -------- Original-Nachricht --------
>> Datum: Wed, 15 Jun 2011 10:36:57 -0400
>> Von: Angel Candelaria <linuxarecibo at gmail.com>
>> An: "SWORD Developers\' Collaboration Forum" <sword-devel at crosswire.org>
>> Betreff: Re: [sword-devel] Help converting text to imp
>
>> Ok, now I see the problem.
>>
>> You are assuming my text file has the verse references on it, but the
>> fact is that it doesn't.  Maybe I didn't explain myself well.  My text
>> file looks like this:
>>
>> In the beginning God created the heavens...
>> And the earth was without form, and void...
>>
>> and so on; no verse references, chapters or book headings, just the
>> texts one after the other until the end.  That's why it didn't work
>>
>> So, in order to be able to use the sed command you gave me, I'll need
>> to add the references first.  Is there a way I can add the references
>> in an automated way, so I can later on use sed to format it to imp?
>>
>> On Wed, Jun 15, 2011 at 10:16 AM, Karl Kleinpaste <karl at kleinpaste.org>
>> wrote:
>> > Angel Candelaria <linuxarecibo at gmail.com> writes:
>> >> For some reason that didn't work
>> >
>> > $ cat text.vpl
>> > gen 1:1 in the beginning god created the heavens and the earth.
>> > john 3:16 for god so loved the world that he gave his only begotten
>> son...
>> > $ sed -e 's/^\(.\+ [0-9]\+:[0-9]\+\) /\$\$\$\1\n/' < text.vpl > text.imp
>> > $ cat text.imp
>> > $$$gen 1:1
>> > in the beginning god created the heavens and the earth.
>> > $$$john 3:16
>> > for god so loved the world that he gave his only begotten son...
>> >
>> >> Now, is there a way to put the corresponding labels after the $$$'s?
>> >
>> > Well, the labels at the beginning of the lines of text.vpl are what end
>> > up in the "$$$" keys.
>> >
>> > _______________________________________________
>> > sword-devel mailing list: sword-devel at crosswire.org
>> > http://www.crosswire.org/mailman/listinfo/sword-devel
>> > Instructions to unsubscribe/change your settings at above page
>> >
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
>



More information about the sword-devel mailing list