Steps for doing subentry promotion with this sample data:
Prep the empty FW database
Create a custom field for the special tags (e.g., call the field SPEC). It can be at the Entry level.
Create a dummy entry (model entry). Make sure it has more than one sense.
Create a dummy subentry (model subentry).
Make it a subentry of one of the senses of the model entry (not the whole entry).
Set the Complex Form Type to be the one you want for the subentries of senses that you will be importing.
In the model subentry, put a text string into the custom field SPEC. This will be the “Model Tag”, a marker to tell the Var2Comp process that this is the model subentry for a certain Complex Form Type. (Your data will have a “Modify Tag” in it, to mark the entries that need to be changed to this Complex Form Type.) Example of a Model Tag: MODEL DERIV ENTRY or __DERIV ENTRY__
It needs to be unique (not likely to be confused with other strings in the project), and it can't be a superstring of the tag you will use in the subentries to be modified.
If you will be importing more than one Complex Form Type, then make one model subentry for each type. Set the Complex Form Type, and fill the SPEC field with a different tag for each type. Example: MODEL COMPOUND ENTRY, MODEL IDIOM ENTRY, etc.
Prep the SFM file: promote the subentries and add the special tag
You can use se2lx.pl to do both of these, after you adjust the settings to recognize "the markers that tell you you are no longer in a subentry", and tell it what to use for the special tag. Or you could do it manually, if there are a small number.
When I ran se2lx.pl on my sample data, the command was like this:
>Perl ./se2lx-BB.pl --inifile se2lx-BB.ini --section se2lx_se MyLanguage-mod03.txt > MyLanguage-mod04-promoted.txt
I had to make sure any senses inside subentries had a different marker (e.g., \sn_SE), because normally a \sn means “you have left the subentry”. I need the senses inside the subentry to stay with it, not end it.
Also make sure all sense markers (\sn or \sn_SE or any others) have a digit in them, and they are unique, since the \mn fields will refer to those.
The result of that script (or doing it by hand) needs to be:
The subentries of senses have been extracted to be their own entry (starting with \lx not \se).
They have an \mn marker referencing the headword, any \hm in it, and the sense number they are a subentry of.
Example: \mn color2 1 refers to \hm 2 of \lx color, and the first sense.
They have a field with a special tag in them for their Complex Form Type. Example: _DERIV_ Make sure it is not a substring of the Model Tag.
The parent entry should not have a reference to the subentry. That is, there should not be an \se in the parent, pointing to the extracted entry.
If you had senses inside subentries (\sn_SE), change those markers back to \sn now, because that is what the import needs. For the import, all sense markers, at all levels (subsense, subentry) need to be \sn.
If you have not yet run the FixPOS-NNN.pl script (from Normalize POS Values ), this is the time to do it.
Import your SFM file into FLEx
Import it into the empty project that has the model entries.
Check that the "subentries of senses" look like "variants of senses" in the resulting FLEx project. That is, the parent entries say they have a variant, and the “subentry of sense” entries say they are a variant of something, and there is a sense number specified with the target, for multi-sense entries.
Look at their Variant Types. [Note to Beth: remove or reword this section.]
In Bulk Edit > List Choice, add columns for “Variant Type” and “Variant Of”.
Filter for Non-Blanks in “Variant of” (to find all the variants) and then look in “Variant Type” and see what values are there.
Filter for Blanks in “Variant Type”, and use Bulk Edit to set it to "Unspecified Variant". (Technically, this step is unnecessary, but it makes things more clear, and it is needed for other kinds of import projects sometimes.)
Make a backup after you import it and fix the Variant Types. Keep the model entries in it.
Make a copy of that backup. You will move that in the next step. Leave the original backup where you had it, as a safeguard in case this process doesn't work.
Prepare a folder just for the Var2Comp process. It is best to have no extra files in the folder. The following files need to be in the folder:
The backup you made in the previous step. This is the backup of the FLEx project that you imported into (including the dummy entries), made after you fix the Variant Types. Make sure there are no other backups in this folder.
PromoteSubentries.ini
Var2Compform.pl
runVar2Compform.sh
Adjust the settings files for the Var2Compform process
The settings file is called PromoteSubentries.ini
Don't touch the variables FwdataIn and FwdataOut. A script in another step will adjust them for you automatically, based on the name of the backup file that is in this folder.
Set modeltag1 to be the tag you put in the SPEC field in the FLEx database for the model subentry. Example: MODEL DERIV ENTRY
Set modifytag1 to be the tag you put in the SFM file in the extracted subentries. Example: _DERIV_
Make more modeltag1/modifytag1 pairs if you have more Complex Form Types, incrementing the number for each pair and setting the values appropriately. Example: modeltag2=MODEL COMPOUND ENTRY modifytag2=_COMPOUND_
Set numberofmodels to the number of different Complex Form Types you have. We are only using one in this example.
Look in the Var2Compform.pl file and verify that the .ini file it is looking for is the one that you have adjusted. (For example, in this sample data, the .ini file is PromoteSubentries-BB.ini, where “BB” represents a language code for your project. If you customized the name of the .ini file for your project, customize it inside Var2Compform.pl also. Search for: my $configfile = 'PromoteSubentries.ini')
Look in runVar2Compform.sh. If you adjusted filenames (e.g., Var2Compform-BB.pl), then make sure the same adjustment is made in this file, wherever it references the .ini or .pl file (lines 22,23).
Run the script
In the WSL terminal, type: ./runVar2Compform.sh (or ./runVar2Compform-BB.sh or whatever you have adjusted the filename to)
That will:
adjust the first two variables in PromoteSubentries.ini, for your FLEx project name
run the Var2Compform.pl script, which will do the following:
extract the .fwdata file from the backup
convert variants marked with your special tag into complex forms with the same Complex Form Type as your Model Subentry
put the .fwdata file back into the (same) backup file
It also leaves the intermediate .fwdata files in this folder; you don't need to do anything with those, and you will want to delete them once you are sure things worked correctly.
In FLEx, restore from the resulting backup (let it overwrite your other project, assuming you kept a copy of the original version of the backup somewhere else).
Verify that you have subentries of senses, with the correct Complex Form Types.
Make a backup, with "Changed Variants to Subentries" in the comment (or something similar).
Proceed to format your “subentries of senses” however you need to format them. You will likely want to make Senses and Subsenses “Display in paragraph”, as well as: Subentries, subentries of senses, and possibly subentries of subsenses. And you may need to create separate styles for each of these, so you can set the indentation separately for each.