Révision 3300
| TXM/trunk/org.txm.imports.metopes/src/org/txm/imports/metopes/DoInstallStep.java (revision 3300) | ||
|---|---|---|
| 43 | 43 |
|
| 44 | 44 |
File macroDirectory = new File(Toolbox.getTxmHomePath(), "scripts/macro/org/txm/macro"); |
| 45 | 45 |
macroDirectory.mkdirs(); |
| 46 |
if (!BundleUtils.copyFiles("org.txm.imports.metopes", "src", "org/txm/macro/", "metopes", macroDirectory)) {
|
|
| 46 |
if (!BundleUtils.copyFiles("org.txm.imports.metopes", "src", "org/txm/macro/", "metopes", macroDirectory, true)) {
|
|
| 47 | 47 |
Log.severe("Error while coping Metopes org/txm/macro/metopes in "+macroDirectory.getAbsolutePath());
|
| 48 | 48 |
return; |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
File importDirectory = new File(Toolbox.getTxmHomePath(), "scripts/import"); |
| 52 | 52 |
importDirectory.mkdirs(); |
| 53 |
if (!BundleUtils.copyFiles("org.txm.imports.metopes", "src", "org/txm/importer/metopes", "metopesLoader.groovy", importDirectory)) {
|
|
| 53 |
if (!BundleUtils.copyFiles("org.txm.imports.metopes", "src", "org/txm/importer/metopes", "metopesLoader.groovy", importDirectory, true)) {
|
|
| 54 | 54 |
Log.severe("Error while coping Metopes org/txm/importer/metopes in "+importDirectory.getAbsolutePath());
|
| 55 | 55 |
return; |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
File xslDirectory = new File(Toolbox.getTxmHomePath(), "xsl"); |
| 59 | 59 |
xslDirectory.mkdirs(); |
| 60 |
if (!BundleUtils.copyFiles("org.txm.imports.metopes", "res", "org/txm/xml/xsl", "metopes", xslDirectory)) {
|
|
| 60 |
if (!BundleUtils.copyFiles("org.txm.imports.metopes", "res", "org/txm/xml/xsl", "metopes", xslDirectory, true)) {
|
|
| 61 | 61 |
Log.severe("Error while coping Metopes org/txm/xml/xsl/metopes in "+xslDirectory.getAbsolutePath());
|
| 62 | 62 |
return; |
| 63 | 63 |
} |
| TXM/trunk/org.txm.rcp/src/main/java/org/eclipse/jface/fieldassist/TXMAutoCompleteField.java (revision 3300) | ||
|---|---|---|
| 1 | 1 |
package org.eclipse.jface.fieldassist; |
| 2 | 2 |
|
| 3 |
import java.util.ArrayList; |
|
| 4 |
|
|
| 5 | 3 |
import org.eclipse.jface.bindings.keys.KeyStroke; |
| 6 |
import org.eclipse.swt.events.SelectionListener; |
|
| 7 | 4 |
import org.eclipse.swt.widgets.Control; |
| 8 | 5 |
|
| 9 | 6 |
/** |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EncodingSection.java (revision 3300) | ||
|---|---|---|
| 89 | 89 |
"ISO-8859-15", "Big5", "Windows-1256", "ISO-8859-9" }; |
| 90 | 90 |
|
| 91 | 91 |
@Override |
| 92 |
public void update(Project project) {
|
|
| 92 |
public void updateFields(Project project) {
|
|
| 93 | 93 |
if (this.section.isDisposed()) return; |
| 94 | 94 |
if (project == null) return; |
| 95 | 95 |
// fill combo and select default encoding |
| ... | ... | |
| 132 | 132 |
} |
| 133 | 133 |
|
| 134 | 134 |
@Override |
| 135 |
public boolean save(Project project) {
|
|
| 135 |
public boolean saveFields(Project project) {
|
|
| 136 | 136 |
if (this.section == null) return true; |
| 137 | 137 |
|
| 138 | 138 |
String encoding = project.getEncoding(); |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FontSection.java (revision 3300) | ||
|---|---|---|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
@Override |
| 74 |
public void update(Project project) {
|
|
| 74 |
public void updateFields(Project project) {
|
|
| 75 | 75 |
if (this.section.isDisposed()) return; |
| 76 | 76 |
if (project == null) return; |
| 77 | 77 |
|
| ... | ... | |
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
@Override |
| 91 |
public boolean save(Project project) {
|
|
| 91 |
public boolean saveFields(Project project) {
|
|
| 92 | 92 |
if (!this.section.isDisposed()) {
|
| 93 | 93 |
String value = fontCombo.getText(); |
| 94 | 94 |
if (DEFAULTFONT.equals(value)) value = ""; |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TRSSection.java (revision 3300) | ||
|---|---|---|
| 1 | 1 |
package org.txm.rcp.editors.imports.sections; |
| 2 | 2 |
|
| 3 |
import java.util.HashMap; |
|
| 4 |
|
|
| 5 | 3 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
| 6 | 4 |
import org.eclipse.swt.SWT; |
| 7 | 5 |
import org.eclipse.swt.widgets.Button; |
| ... | ... | |
| 91 | 89 |
} |
| 92 | 90 |
|
| 93 | 91 |
@Override |
| 94 |
public void update(Project project) {
|
|
| 92 |
public void updateFields(Project project) {
|
|
| 95 | 93 |
if (this.section.isDisposed()) return; |
| 96 | 94 |
if (project == null) return; |
| 97 | 95 |
|
| ... | ... | |
| 103 | 101 |
} |
| 104 | 102 |
|
| 105 | 103 |
@Override |
| 106 |
public boolean save(Project project) {
|
|
| 104 |
public boolean saveFields(Project project) {
|
|
| 107 | 105 |
if (this.section != null && !this.section.isDisposed()) {
|
| 108 | 106 |
|
| 109 | 107 |
IEclipsePreferences customNode = project.getImportParameters(); |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java (revision 3300) | ||
|---|---|---|
| 310 | 310 |
} |
| 311 | 311 |
|
| 312 | 312 |
@Override |
| 313 |
public void update(Project project) {
|
|
| 313 |
public void updateFields(Project project) {
|
|
| 314 | 314 |
if (this.section.isDisposed()) return; |
| 315 | 315 |
if (project == null) return; |
| 316 | 316 |
|
| ... | ... | |
| 338 | 338 |
} |
| 339 | 339 |
|
| 340 | 340 |
@Override |
| 341 |
public boolean save(Project project) {
|
|
| 341 |
public boolean saveFields(Project project) {
|
|
| 342 | 342 |
|
| 343 | 343 |
if (textWhiteSpaces.getText().length() == 0 && textPuncts.getText().length() == 0) {
|
| 344 | 344 |
System.out.println(TXMUIMessages.errorWhileSavingTokenizerParameters); |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java (revision 3300) | ||
|---|---|---|
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 | 255 |
@Override |
| 256 |
public void update(Project project) {
|
|
| 256 |
public void updateFields(Project project) {
|
|
| 257 | 257 |
if (this.section.isDisposed()) return; |
| 258 | 258 |
if (project == null) return; |
| 259 | 259 |
|
| ... | ... | |
| 294 | 294 |
if (defaults != null && defaults.length() > 0 && defaultEditions != null) {
|
| 295 | 295 |
defaultEditions.setText(defaults); |
| 296 | 296 |
} |
| 297 |
|
|
| 297 | 298 |
} |
| 298 | 299 |
|
| 299 | 300 |
@Override |
| 300 |
public boolean save(Project project) {
|
|
| 301 |
public boolean saveFields(Project project) {
|
|
| 301 | 302 |
if (this.section != null && !this.section.isDisposed()) {
|
| 302 | 303 |
|
| 303 | 304 |
String page_break_tag = "pb"; |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/OptionsSection.java (revision 3300) | ||
|---|---|---|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
@Override |
| 59 |
public void update(Project project) {
|
|
| 59 |
public void updateFields(Project project) {
|
|
| 60 | 60 |
cleanButton.setSelection(project.getCleanAfterBuild()); |
| 61 | 61 |
// |
| 62 | 62 |
//// value = (String) params.getKeyValueParameters().get(ImportKeys.MULTITHREAD); |
| ... | ... | |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
@Override |
| 68 |
public boolean save(Project project) {
|
|
| 68 |
public boolean saveFields(Project project) {
|
|
| 69 | 69 |
if (this.section != null && !section.isDisposed()) {
|
| 70 | 70 |
// |
| 71 | 71 |
project.setCleanAfterBuild(cleanButton.getSelection()); |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/InfosSection.java (revision 3300) | ||
|---|---|---|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
@Override |
| 76 |
public void update(Project project) {
|
|
| 76 |
public void updateFields(Project project) {
|
|
| 77 | 77 |
section.setText(NLS.bind(TXMUIMessages.descriptionOfTheP0CorpusP1, project.getName(), project.getSrcdir())); |
| 78 | 78 |
|
| 79 | 79 |
String descContent = project.getDescription(); |
| ... | ... | |
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
@Override |
| 89 |
public boolean save(Project project) {
|
|
| 89 |
public boolean saveFields(Project project) {
|
|
| 90 | 90 |
project.setDescription("<pre><br/>" + descText.getText().replace("\n", "<br/>") + "</pre>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
| 91 | 91 |
|
| 92 | 92 |
return true; |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java (revision 3300) | ||
|---|---|---|
| 194 | 194 |
} |
| 195 | 195 |
|
| 196 | 196 |
@Override |
| 197 |
public void update(Project project) {
|
|
| 197 |
public void updateFields(Project project) {
|
|
| 198 | 198 |
if (this.section.isDisposed()) return; |
| 199 | 199 |
|
| 200 | 200 |
this.project = project; |
| ... | ... | |
| 210 | 210 |
} |
| 211 | 211 |
|
| 212 | 212 |
@Override |
| 213 |
public boolean save(Project project) {
|
|
| 213 |
public boolean saveFields(Project project) {
|
|
| 214 | 214 |
if (xsltfileValue != null && !xsltfileValue.isDisposed()) |
| 215 | 215 |
project.setXslt(xsltfileValue.getText()); |
| 216 | 216 |
|
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/CommandsSection.java (revision 3300) | ||
|---|---|---|
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 | 102 |
@Override |
| 103 |
public void update(Project project) {
|
|
| 103 |
public void updateFields(Project project) {
|
|
| 104 | 104 |
CorpusCommandPreferences concPrefs = project.getCommandPreferences("concordance");
|
| 105 | 105 |
if (concPrefs.get("context_limits") != null) {
|
| 106 | 106 |
structLimitsText.setText(concPrefs.get("context_limits"));
|
| ... | ... | |
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 | 129 |
@Override |
| 130 |
public boolean save(Project project) {
|
|
| 130 |
public boolean saveFields(Project project) {
|
|
| 131 | 131 |
if (this.section != null && !section.isDisposed()) {
|
| 132 | 132 |
CorpusCommandPreferences concPrefs = project.getCommandPreferences("concordance");
|
| 133 | 133 |
concPrefs.set("context_limits_type", "list");
|
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/ImportEditorSection.java (revision 3300) | ||
|---|---|---|
| 1 | 1 |
package org.txm.rcp.editors.imports.sections; |
| 2 | 2 |
|
| 3 | 3 |
import java.lang.reflect.Field; |
| 4 |
import java.util.ArrayList; |
|
| 4 | 5 |
|
| 5 | 6 |
import org.eclipse.swt.widgets.Composite; |
| 6 | 7 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
| ... | ... | |
| 10 | 11 |
import org.txm.core.results.BeanParameters; |
| 11 | 12 |
import org.txm.core.results.Parameter; |
| 12 | 13 |
import org.txm.objects.Project; |
| 13 |
import org.txm.rcp.editors.TXMEditor; |
|
| 14 |
import org.txm.rcp.messages.TXMUIMessages; |
|
| 15 | 14 |
import org.w3c.dom.Document; |
| 16 | 15 |
import org.w3c.dom.Element; |
| 17 | 16 |
import org.w3c.dom.NodeList; |
| 18 | 17 |
|
| 19 | 18 |
public abstract class ImportEditorSection {
|
| 20 | 19 |
|
| 20 |
ArrayList<ImportSubSection> subsections = new ArrayList<ImportSubSection>(); |
|
| 21 |
|
|
| 21 | 22 |
public static TableWrapData getButtonLayoutData() {
|
| 22 | 23 |
TableWrapData td = new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE); |
| 23 | 24 |
return td; |
| ... | ... | |
| 46 | 47 |
return gdata; |
| 47 | 48 |
} |
| 48 | 49 |
|
| 50 |
public FormToolkit getToolkit() {
|
|
| 51 |
return toolkit; |
|
| 52 |
} |
|
| 53 |
|
|
| 54 |
public ScrolledForm getScrolledForm() {
|
|
| 55 |
return form; |
|
| 56 |
} |
|
| 57 |
|
|
| 58 |
public Section getSection() {
|
|
| 59 |
return section; |
|
| 60 |
} |
|
| 61 |
|
|
| 49 | 62 |
protected ScrolledForm form; |
| 50 | 63 |
|
| 51 | 64 |
protected Project project; |
| ... | ... | |
| 80 | 93 |
* @param project |
| 81 | 94 |
* @return true if all necessary parameters are set |
| 82 | 95 |
*/ |
| 96 |
public final boolean check() {
|
|
| 97 |
|
|
| 98 |
if (this.checkFields()) {
|
|
| 99 |
for (ImportSubSection sub : subsections) {
|
|
| 100 |
if (!sub.checkFields()) {
|
|
| 101 |
return false; |
|
| 102 |
} |
|
| 103 |
} |
|
| 104 |
return true; |
|
| 105 |
} |
|
| 106 |
return false; |
|
| 107 |
} |
|
| 108 |
|
|
| 109 |
/** |
|
| 110 |
* Check if all necessary parameters are set |
|
| 111 |
* |
|
| 112 |
* @param project |
|
| 113 |
* @return true if all necessary parameters are set |
|
| 114 |
*/ |
|
| 83 | 115 |
public abstract boolean checkFields(); |
| 84 | 116 |
|
| 85 | 117 |
public abstract int getSectionSize(); // 1 2 3, it depends the number of element inserted in the form |
| ... | ... | |
| 93 | 125 |
* Update the Project import parameters using the section widgets values |
| 94 | 126 |
* |
| 95 | 127 |
* @param project |
| 96 |
* @deprecated interface write parameters in a import.xml |
|
| 97 | 128 |
*/ |
| 98 |
@Deprecated |
|
| 99 |
public abstract boolean save(Project params); |
|
| 129 |
public final boolean save(Project project) {
|
|
| 130 |
|
|
| 131 |
if (this.saveFields(project)) {
|
|
| 132 |
for (ImportSubSection sub : subsections) {
|
|
| 133 |
if (!sub.saveFields(project)) {
|
|
| 134 |
return false; |
|
| 135 |
} |
|
| 136 |
} |
|
| 137 |
return true; |
|
| 138 |
} |
|
| 139 |
return false; |
|
| 140 |
} |
|
| 100 | 141 |
|
| 101 | 142 |
/** |
| 143 |
* Update the Project import parameters using the section widgets values |
|
| 144 |
* |
|
| 145 |
* @param project |
|
| 146 |
*/ |
|
| 147 |
public abstract boolean saveFields(Project project); |
|
| 148 |
|
|
| 149 |
/** |
|
| 102 | 150 |
* write interface parameters to a XML DOM |
| 103 | 151 |
* |
| 152 |
* NOT USED YET |
|
| 153 |
* |
|
| 104 | 154 |
* @param xmlFile |
| 105 | 155 |
*/ |
| 106 | 156 |
public boolean save(Document document) {
|
| 157 |
|
|
| 107 | 158 |
NodeList sectionList = document.getElementsByTagName("section");
|
| 108 | 159 |
Element sectionElement = null; |
| 109 | 160 |
for (int i = 0; i < sectionList.getLength(); i++) {
|
| ... | ... | |
| 133 | 184 |
* Update the section widgets with the Project import parameters |
| 134 | 185 |
* |
| 135 | 186 |
* @param project |
| 136 |
* @deprecated interface is now loaded from a import.xml file |
|
| 137 | 187 |
*/ |
| 138 |
@Deprecated |
|
| 139 |
public abstract void update(Project project); |
|
| 188 |
public final void update(Project project) {
|
|
| 189 |
|
|
| 190 |
this.updateFields(project); |
|
| 191 |
for (ImportSubSection sub : subsections) {
|
|
| 192 |
sub.updateFields(project); |
|
| 193 |
} |
|
| 194 |
} |
|
| 195 |
|
|
| 196 |
/** |
|
| 197 |
* Update the section widgets with the Project import parameters |
|
| 198 |
* |
|
| 199 |
* @param project |
|
| 200 |
*/ |
|
| 201 |
public abstract void updateFields(Project project); |
|
| 140 | 202 |
} |
| 141 | 203 |
|
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java (revision 3300) | ||
|---|---|---|
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 | 150 |
@Override |
| 151 |
public void update(Project project) {
|
|
| 151 |
public void updateFields(Project project) {
|
|
| 152 | 152 |
if (this.section.isDisposed()) return; |
| 153 | 153 |
if (project == null) return; |
| 154 | 154 |
|
| ... | ... | |
| 189 | 189 |
} |
| 190 | 190 |
|
| 191 | 191 |
@Override |
| 192 |
public boolean save(Project project) {
|
|
| 192 |
public boolean saveFields(Project project) {
|
|
| 193 | 193 |
if (!this.section.isDisposed()) {
|
| 194 | 194 |
// LANGUAGE |
| 195 | 195 |
String lang = null, annotate = null; |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/ImportSubSection.java (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.rcp.editors.imports.sections; |
|
| 2 |
|
|
| 3 |
import org.eclipse.swt.SWT; |
|
| 4 |
import org.txm.objects.Project; |
|
| 5 |
import org.txm.rcp.swt.GLComposite; |
|
| 6 |
|
|
| 7 |
public abstract class ImportSubSection extends GLComposite {
|
|
| 8 |
|
|
| 9 |
protected ImportEditorSection isection; |
|
| 10 |
|
|
| 11 |
public ImportSubSection(ImportEditorSection isection, String name) {
|
|
| 12 |
|
|
| 13 |
super(isection.section, SWT.NONE, name); |
|
| 14 |
this.isection = isection; |
|
| 15 |
} |
|
| 16 |
|
|
| 17 |
public abstract void updateFields(Project project); |
|
| 18 |
|
|
| 19 |
public abstract boolean saveFields(Project project); |
|
| 20 |
|
|
| 21 |
public abstract boolean checkFields(); |
|
| 22 |
} |
|
| 0 | 23 | |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TextualPlansSection.java (revision 3300) | ||
|---|---|---|
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 | 86 |
@Override |
| 87 |
public void update(Project project) {
|
|
| 87 |
public void updateFields(Project project) {
|
|
| 88 | 88 |
if (this.section != null && !section.isDisposed()) {
|
| 89 | 89 |
outsideTextElementsText.setText(project.getTextualPlan("OutSideTextTags"));
|
| 90 | 90 |
outsideTextElementsToEditText.setText(project.getTextualPlan("OutSideTextTagsAndKeepContent"));
|
| ... | ... | |
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 | 96 |
@Override |
| 97 |
public boolean save(Project project) {
|
|
| 97 |
public boolean saveFields(Project project) {
|
|
| 98 | 98 |
if (this.section != null && !section.isDisposed()) {
|
| 99 | 99 |
|
| 100 | 100 |
project.setTextualPlan("OutSideTextTags", outsideTextElementsText.getText().trim());
|
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java (revision 3300) | ||
|---|---|---|
| 27 | 27 |
// |
| 28 | 28 |
package org.txm.rcp.editors.imports; |
| 29 | 29 |
|
| 30 |
import java.io.File; |
|
| 31 | 30 |
import java.io.IOException; |
| 32 | 31 |
import java.lang.reflect.Constructor; |
| 33 |
import java.lang.reflect.InvocationTargetException; |
|
| 34 |
import java.util.Date; |
|
| 35 | 32 |
import java.util.HashMap; |
| 36 | 33 |
|
| 37 | 34 |
import javax.xml.parsers.ParserConfigurationException; |
| ... | ... | |
| 49 | 46 |
import org.eclipse.swt.widgets.Display; |
| 50 | 47 |
import org.eclipse.swt.widgets.Label; |
| 51 | 48 |
import org.eclipse.ui.IEditorPart; |
| 52 |
import org.eclipse.ui.IWorkbenchPartConstants; |
|
| 53 | 49 |
import org.eclipse.ui.forms.IManagedForm; |
| 54 | 50 |
import org.eclipse.ui.forms.editor.FormPage; |
| 55 | 51 |
import org.eclipse.ui.forms.events.HyperlinkAdapter; |
| ... | ... | |
| 62 | 58 |
import org.eclipse.ui.forms.widgets.Section; |
| 63 | 59 |
import org.eclipse.ui.forms.widgets.TableWrapData; |
| 64 | 60 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
| 65 |
import org.txm.metadatas.Metadatas; |
|
| 66 | 61 |
import org.txm.objects.Project; |
| 67 | 62 |
import org.txm.rcp.IImageKeys; |
| 68 | 63 |
import org.txm.rcp.corpuswizard.ImportWizard; |
| 64 |
import org.txm.rcp.editors.imports.sections.CommandsSection; |
|
| 69 | 65 |
import org.txm.rcp.editors.imports.sections.EditionSection; |
| 70 | 66 |
import org.txm.rcp.editors.imports.sections.EncodingSection; |
| 71 | 67 |
import org.txm.rcp.editors.imports.sections.FontSection; |
| ... | ... | |
| 76 | 72 |
import org.txm.rcp.editors.imports.sections.OptionsSection; |
| 77 | 73 |
import org.txm.rcp.editors.imports.sections.TextualPlansSection; |
| 78 | 74 |
import org.txm.rcp.editors.imports.sections.TokenizerSection; |
| 79 |
import org.txm.rcp.editors.imports.sections.CommandsSection; |
|
| 80 |
import org.txm.rcp.handlers.results.DeleteObject; |
|
| 81 | 75 |
import org.txm.rcp.handlers.scripts.ExecuteImportScript; |
| 82 | 76 |
import org.txm.rcp.messages.TXMUIMessages; |
| 83 | 77 |
import org.txm.rcp.utils.SWTEditorsUtils; |
| 84 |
import org.txm.utils.AsciiUtils; |
|
| 85 | 78 |
import org.txm.utils.logger.Log; |
| 86 |
import org.w3c.dom.Element; |
|
| 87 |
import org.w3c.dom.NodeList; |
|
| 88 | 79 |
import org.xml.sax.SAXException; |
| 89 | 80 |
|
| 90 | 81 |
/** |
| ... | ... | |
| 753 | 744 |
if (project != null) {
|
| 754 | 745 |
saveConfig(); |
| 755 | 746 |
} |
| 756 |
else |
|
| 747 |
else {
|
|
| 757 | 748 |
System.out.println(TXMUIMessages.cannotStartImportConfigurationNoSourceFolderSelected); |
| 749 |
} |
|
| 758 | 750 |
} |
| 759 | 751 |
}; |
| 760 | 752 |
|
| ... | ... | |
| 769 | 761 |
startImport(); |
| 770 | 762 |
} |
| 771 | 763 |
} |
| 772 |
else |
|
| 764 |
else {
|
|
| 773 | 765 |
System.out.println(TXMUIMessages.cannotStartImportConfigurationNoSourceFolderSelected); |
| 766 |
} |
|
| 774 | 767 |
} |
| 775 | 768 |
}; |
| 776 | 769 |
|
| ... | ... | |
| 939 | 932 |
// TEST ALL SECTIONS |
| 940 | 933 |
boolean doSave = true; |
| 941 | 934 |
if (infosSection != null && !infosSection.isDisposed()) {
|
| 942 |
doSave = doSave & infosSection.checkFields();
|
|
| 935 |
doSave = doSave & infosSection.check(); |
|
| 943 | 936 |
} |
| 944 | 937 |
if (langSection != null && !langSection.isDisposed()) {
|
| 945 |
doSave = doSave & langSection.checkFields();
|
|
| 938 |
doSave = doSave & langSection.check(); |
|
| 946 | 939 |
} |
| 947 | 940 |
if (xsltSection != null && !xsltSection.isDisposed()) {
|
| 948 |
doSave = doSave & xsltSection.checkFields();
|
|
| 941 |
doSave = doSave & xsltSection.check(); |
|
| 949 | 942 |
} |
| 950 | 943 |
if (tokenizerSection != null && !tokenizerSection.isDisposed()) {
|
| 951 |
doSave = doSave & tokenizerSection.checkFields();
|
|
| 944 |
doSave = doSave & tokenizerSection.check(); |
|
| 952 | 945 |
} |
| 953 | 946 |
if (uiSection != null && !uiSection.isDisposed()) {
|
| 954 |
doSave = doSave & uiSection.checkFields();
|
|
| 947 |
doSave = doSave & uiSection.check(); |
|
| 955 | 948 |
} |
| 956 | 949 |
if (encodingSection != null && !encodingSection.isDisposed()) {
|
| 957 |
doSave = doSave & encodingSection.checkFields();
|
|
| 950 |
doSave = doSave & encodingSection.check(); |
|
| 958 | 951 |
} |
| 959 | 952 |
if (editionSection != null && !editionSection.isDisposed()) {
|
| 960 |
doSave = doSave & editionSection.checkFields();
|
|
| 953 |
doSave = doSave & editionSection.check(); |
|
| 961 | 954 |
} |
| 962 | 955 |
if (fontSection != null && !fontSection.isDisposed()) {
|
| 963 |
doSave = doSave & fontSection.checkFields();
|
|
| 956 |
doSave = doSave & fontSection.check(); |
|
| 964 | 957 |
} |
| 965 | 958 |
if (textualPlansSection != null && !textualPlansSection.isDisposed()) {
|
| 966 |
doSave = doSave & textualPlansSection.checkFields();
|
|
| 959 |
doSave = doSave & textualPlansSection.check(); |
|
| 967 | 960 |
} |
| 968 | 961 |
if (optionsSection != null && !optionsSection.isDisposed()) {
|
| 969 |
doSave = doSave & optionsSection.checkFields();
|
|
| 962 |
doSave = doSave & optionsSection.check(); |
|
| 970 | 963 |
} |
| 971 | 964 |
if (additionalSection != null && !additionalSection.isDisposed()) {
|
| 972 |
doSave = doSave & additionalSection.checkFields();
|
|
| 965 |
doSave = doSave & additionalSection.check(); |
|
| 973 | 966 |
} |
| 974 | 967 |
if (!doSave) {
|
| 975 | 968 |
System.out.println("Some fields are not correctly filled.");
|
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportEditorSectionConfigurator.java (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.rcp.editors.imports; |
|
| 2 |
|
|
| 3 |
|
|
| 4 |
/** |
|
| 5 |
* Section configurator that adds section or subsection (a part of section) |
|
| 6 |
* |
|
| 7 |
* @author mdecorde |
|
| 8 |
* |
|
| 9 |
*/ |
|
| 10 |
public abstract class ImportEditorSectionConfigurator {
|
|
| 11 |
|
|
| 12 |
public ImportEditorSectionConfigurator() {
|
|
| 13 |
|
|
| 14 |
} |
|
| 15 |
|
|
| 16 |
public abstract void installSections(); |
|
| 17 |
} |
|
| 0 | 18 | |
| TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java (revision 3300) | ||
|---|---|---|
| 3 | 3 |
import java.util.HashMap; |
| 4 | 4 |
import java.util.LinkedHashMap; |
| 5 | 5 |
|
| 6 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
| 7 |
import org.eclipse.core.runtime.IContributor; |
|
| 8 |
import org.eclipse.core.runtime.RegistryFactory; |
|
| 9 |
import org.txm.core.messages.TXMCoreMessages; |
|
| 6 | 10 |
import org.txm.rcp.editors.imports.sections.ImportEditorSection; |
| 7 | 11 |
import org.txm.rcp.editors.imports.sections.TRSSection; |
| 12 |
import org.txm.utils.logger.Log; |
|
| 8 | 13 |
|
| 9 | 14 |
/** |
| 10 | 15 |
* static class that defines what parameters are used by import modules |
| ... | ... | |
| 46 | 51 |
|
| 47 | 52 |
public static final String IMPORT_NAME = "import_name"; |
| 48 | 53 |
|
| 49 |
static HashMap<String, HashMap<String, Boolean>> sectionsPerImportModule = new HashMap<>(); |
|
| 54 |
public static HashMap<String, HashMap<String, Boolean>> sectionsPerImportModule = new HashMap<>();
|
|
| 50 | 55 |
|
| 51 |
static HashMap<String, Class<? extends ImportEditorSection>> additionalSections = new HashMap<>(); |
|
| 56 |
public static HashMap<String, Class<? extends ImportEditorSection>> additionalSections = new HashMap<>();
|
|
| 52 | 57 |
|
| 53 |
static HashMap<String, String> names = new HashMap<>(); |
|
| 58 |
public static HashMap<String, String> names = new HashMap<>();
|
|
| 54 | 59 |
|
| 55 | 60 |
static { // init import module
|
| 56 | 61 |
HashMap<String, Boolean> params = new HashMap<>(); |
| ... | ... | |
| 167 | 172 |
params.put(OPTIONS, true); |
| 168 | 173 |
sectionsPerImportModule.put("transcriberLoader.groovy", params); //$NON-NLS-1$
|
| 169 | 174 |
names.put("transcriberLoader.groovy", "XML-TRS + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
|
| 170 |
additionalSections.put("transcriberLoader.groovy", TRSSection.class);
|
|
| 171 | 175 |
|
| 172 | 176 |
params = new HashMap<>(); |
| 173 | 177 |
params.put(PARALLEL, false); |
| ... | ... | |
| 320 | 324 |
params.put(OPTIONS, true); |
| 321 | 325 |
sectionsPerImportModule.put("xtzLoader.groovy", params); //$NON-NLS-1$
|
| 322 | 326 |
names.put("xtzLoader.groovy", "XML-TEI Zero + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
|
| 327 |
|
|
| 328 |
IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor("org.txm.rcp.importsection");
|
|
| 329 |
|
|
| 330 |
for (int i = 0; i < contributions.length; i++) {
|
|
| 331 |
try {
|
|
| 332 |
IContributor c = contributions[i].getContributor(); |
|
| 333 |
@SuppressWarnings("unchecked")
|
|
| 334 |
ImportEditorSectionConfigurator iesc = (ImportEditorSectionConfigurator) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
|
|
| 335 |
|
|
| 336 |
Log.fine(TXMCoreMessages.bind("Initializing import section with: {0}...", iesc));
|
|
| 337 |
|
|
| 338 |
iesc.installSections(); |
|
| 339 |
} |
|
| 340 |
catch (Exception e) {
|
|
| 341 |
Log.severe("Error: failed to instantiate " + contributions[i].getName() + ".");
|
|
| 342 |
e.printStackTrace(); |
|
| 343 |
} |
|
| 344 |
} |
|
| 345 |
additionalSections.put("transcriberLoader.groovy", TRSSection.class);
|
|
| 323 | 346 |
} |
| 324 | 347 |
|
| 325 | 348 |
/** |
| TXM/trunk/org.txm.rcp/plugin.xml (revision 3300) | ||
|---|---|---|
| 3 | 3 |
<plugin> |
| 4 | 4 |
<extension-point id="org.txm.rcp.extentionpoint.command" name="%extension-point.name" schema="schema/org.txm.rcp.extentionpoint.command.exsd"/> |
| 5 | 5 |
<extension-point id="org.txm.rcp.editors.TXMEditorExtension" name="%extension-point.name.0" schema="schema/org.txm.rcp.editors.TXMEditorExtension.exsd"/> |
| 6 |
<extension-point id="org.txm.rcp.importsection" name="Import parameter section" schema="schema/org.txm.rcp.importsection.exsd"/> |
|
| 6 | 7 |
|
| 7 | 8 |
<extension |
| 8 | 9 |
id="Application" |
| TXM/trunk/org.txm.rcp/schema/org.txm.rcp.importsection.exsd (revision 3300) | ||
|---|---|---|
| 1 |
<?xml version='1.0' encoding='UTF-8'?> |
|
| 2 |
<!-- Schema file written by PDE --> |
|
| 3 |
<schema targetNamespace="org.txm.rcp" xmlns="http://www.w3.org/2001/XMLSchema"> |
|
| 4 |
<annotation> |
|
| 5 |
<appinfo> |
|
| 6 |
<meta.schema plugin="org.txm.rcp" id="org.txm.rcp.importsection" name="Import parameter section"/> |
|
| 7 |
</appinfo> |
|
| 8 |
<documentation> |
|
| 9 |
[Enter description of this extension point.] |
|
| 10 |
</documentation> |
|
| 11 |
</annotation> |
|
| 12 |
|
|
| 13 |
<element name="extension"> |
|
| 14 |
<annotation> |
|
| 15 |
<appinfo> |
|
| 16 |
<meta.element /> |
|
| 17 |
</appinfo> |
|
| 18 |
</annotation> |
|
| 19 |
<complexType> |
|
| 20 |
<choice minOccurs="1" maxOccurs="unbounded"> |
|
| 21 |
<element ref="importsectionconfiguration"/> |
|
| 22 |
</choice> |
|
| 23 |
<attribute name="point" type="string" use="required"> |
|
| 24 |
<annotation> |
|
| 25 |
<documentation> |
|
| 26 |
|
|
| 27 |
</documentation> |
|
| 28 |
</annotation> |
|
| 29 |
</attribute> |
|
| 30 |
<attribute name="id" type="string"> |
|
| 31 |
<annotation> |
|
| 32 |
<documentation> |
|
| 33 |
|
|
| 34 |
</documentation> |
|
| 35 |
</annotation> |
|
| 36 |
</attribute> |
|
| 37 |
<attribute name="name" type="string"> |
|
| 38 |
<annotation> |
|
| 39 |
<documentation> |
|
| 40 |
|
|
| 41 |
</documentation> |
|
| 42 |
<appinfo> |
|
| 43 |
<meta.attribute translatable="true"/> |
|
| 44 |
</appinfo> |
|
| 45 |
</annotation> |
|
| 46 |
</attribute> |
|
| 47 |
</complexType> |
|
| 48 |
</element> |
|
| 49 |
|
|
| 50 |
<element name="importsectionconfiguration"> |
|
| 51 |
<complexType> |
|
| 52 |
<attribute name="class" type="string"> |
|
| 53 |
<annotation> |
|
| 54 |
<documentation> |
|
| 55 |
|
|
| 56 |
</documentation> |
|
| 57 |
<appinfo> |
|
| 58 |
<meta.attribute kind="java" basedOn="org.txm.rcp.editors.imports.ImportEditorSectionConfigurator:"/> |
|
| 59 |
</appinfo> |
|
| 60 |
</annotation> |
|
| 61 |
</attribute> |
|
| 62 |
</complexType> |
|
| 63 |
</element> |
|
| 64 |
|
|
| 65 |
<annotation> |
|
| 66 |
<appinfo> |
|
| 67 |
<meta.section type="since"/> |
|
| 68 |
</appinfo> |
|
| 69 |
<documentation> |
|
| 70 |
[Enter the first release in which this extension point appears.] |
|
| 71 |
</documentation> |
|
| 72 |
</annotation> |
|
| 73 |
|
|
| 74 |
<annotation> |
|
| 75 |
<appinfo> |
|
| 76 |
<meta.section type="examples"/> |
|
| 77 |
</appinfo> |
|
| 78 |
<documentation> |
|
| 79 |
[Enter extension point usage example here.] |
|
| 80 |
</documentation> |
|
| 81 |
</annotation> |
|
| 82 |
|
|
| 83 |
<annotation> |
|
| 84 |
<appinfo> |
|
| 85 |
<meta.section type="apiinfo"/> |
|
| 86 |
</appinfo> |
|
| 87 |
<documentation> |
|
| 88 |
[Enter API information here.] |
|
| 89 |
</documentation> |
|
| 90 |
</annotation> |
|
| 91 |
|
|
| 92 |
<annotation> |
|
| 93 |
<appinfo> |
|
| 94 |
<meta.section type="implementation"/> |
|
| 95 |
</appinfo> |
|
| 96 |
<documentation> |
|
| 97 |
[Enter information about supplied implementation of this extension point.] |
|
| 98 |
</documentation> |
|
| 99 |
</annotation> |
|
| 100 |
|
|
| 101 |
|
|
| 102 |
</schema> |
|
| 0 | 103 | |
| TXM/trunk/org.txm.tigersearch.rcp/groovy/org/txm/macro/ud/UD2TigerXMLMacro.groovy (revision 3300) | ||
|---|---|---|
| 48 | 48 |
// for Profiterole project (2019-2021) |
| 49 | 49 |
|
| 50 | 50 |
// 2019-09-25 |
| 51 |
// - updated default column numbers for CONNL-U SRCMF format
|
|
| 51 |
// - updated default column numbers for CONLL-U SRCMF format
|
|
| 52 | 52 |
// - added processing for comment lines |
| 53 | 53 |
// - added @textid to terminal nodes |
| 54 | 54 |
// - deleted ppos, pmor et plemma (predicted tags and lemmas) |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TSResult.java (revision 3300) | ||
|---|---|---|
| 186 | 186 |
return matches[matchNo]; |
| 187 | 187 |
} |
| 188 | 188 |
|
| 189 |
public void setDisplayProperties(List<String> tprops, String feature) {
|
|
| 189 |
public void setDisplayProperties(ArrayList<String> tprops, String feature) {
|
|
| 190 | 190 |
tsCorpus.setDisplayProperties(this.header, tprops, feature); |
| 191 | 191 |
} |
| 192 | 192 |
|
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/test/DrawTSSVG.java (revision 3300) | ||
|---|---|---|
| 1 | 1 |
package org.txm.test; |
| 2 | 2 |
|
| 3 | 3 |
import java.io.File; |
| 4 |
import java.util.ArrayList; |
|
| 4 | 5 |
import java.util.Arrays; |
| 5 | 6 |
|
| 6 | 7 |
import org.txm.searchengine.ts.TSCorpus; |
| ... | ... | |
| 32 | 33 |
|
| 33 | 34 |
TSResult result = corpus.query(query); |
| 34 | 35 |
|
| 35 |
result.setDisplayProperties(Arrays.asList("word", "pos", "form"), "type");
|
|
| 36 |
result.setDisplayProperties(new ArrayList<>(Arrays.asList("word", "pos", "form")), "type");
|
|
| 36 | 37 |
|
| 37 | 38 |
TSMatch first = result.getFirst(); |
| 38 | 39 |
System.out.println("First: nb of sub graph: "+first.getNumberOfSubGraph());
|
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/commands/DoInstall.java (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.tigersearch.commands; |
|
| 2 |
|
|
| 3 |
import java.io.File; |
|
| 4 |
|
|
| 5 |
import org.txm.PostInstallationStep; |
|
| 6 |
import org.txm.Toolbox; |
|
| 7 |
import org.txm.utils.BundleUtils; |
|
| 8 |
|
|
| 9 |
public class DoInstall extends PostInstallationStep {
|
|
| 10 |
|
|
| 11 |
protected String name = "TIGERSearch"; //$NON-NLS-1$ |
|
| 12 |
|
|
| 13 |
public void install() |
|
| 14 |
{
|
|
| 15 |
File outputDirectory = new File(Toolbox.getTxmHomePath(), "scripts/import"); |
|
| 16 |
outputDirectory.mkdirs(); |
|
| 17 |
BundleUtils.copyFiles("org.txm.tigersearch.rcp", "groovy", "org/txm/importer/tigersearch", "tigersearchLoader.groovy", outputDirectory);
|
|
| 18 |
} |
|
| 19 |
} |
|
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/InstallGroovyTIGERFiles.java (revision 3300) | ||
|---|---|---|
| 41 | 41 |
|
| 42 | 42 |
scriptsPackageDirectory.mkdirs(); |
| 43 | 43 |
scriptsPackageDirectory2.mkdirs(); |
| 44 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory); |
|
| 45 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory2); |
|
| 44 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory, true);
|
|
| 45 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory2, true);
|
|
| 46 | 46 |
|
| 47 | 47 |
// MACROS |
| 48 |
|
|
| 49 | 48 |
scriptsPackageDirectory = new File(userDirectory, "org/txm/macro/tiger"); |
| 50 | 49 |
scriptsPackageDirectory2 = new File(systemDirectory, "org/txm/macro/tiger"); |
| 51 | 50 |
|
| ... | ... | |
| 58 | 57 |
|
| 59 | 58 |
scriptsPackageDirectory.mkdirs(); |
| 60 | 59 |
scriptsPackageDirectory2.mkdirs(); |
| 61 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory); |
|
| 62 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory2); |
|
| 60 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory, true);
|
|
| 61 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory2, true);
|
|
| 63 | 62 |
|
| 64 | 63 |
return scriptsPackageDirectory.exists(); |
| 65 | 64 |
} |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/imports/TIGERImportSectionConfigurator.java (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.tigersearch.imports; |
|
| 2 |
|
|
| 3 |
|
|
| 4 |
import org.txm.rcp.editors.imports.ImportEditorSectionConfigurator; |
|
| 5 |
import org.txm.rcp.editors.imports.ImportModuleCustomization; |
|
| 6 |
|
|
| 7 |
|
|
| 8 |
public class TIGERImportSectionConfigurator extends ImportEditorSectionConfigurator {
|
|
| 9 |
|
|
| 10 |
@Override |
|
| 11 |
public void installSections() {
|
|
| 12 |
|
|
| 13 |
ImportModuleCustomization.additionalSections.put("tigersearchLoader.groovy", TIGERSection.class);
|
|
| 14 |
} |
|
| 15 |
} |
|
| 0 | 16 | |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/imports/TIGERSection.java (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.tigersearch.imports; |
|
| 2 |
|
|
| 3 |
|
|
| 4 |
import org.eclipse.swt.widgets.Button; |
|
| 5 |
import org.eclipse.swt.widgets.Composite; |
|
| 6 |
import org.eclipse.ui.forms.events.ExpansionAdapter; |
|
| 7 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
|
| 8 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
| 9 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
|
| 10 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
|
| 11 |
import org.osgi.service.prefs.Preferences; |
|
| 12 |
import org.txm.objects.Project; |
|
| 13 |
import org.txm.rcp.editors.imports.sections.ImportEditorSection; |
|
| 14 |
|
|
| 15 |
public class TIGERSection extends ImportEditorSection {
|
|
| 16 |
|
|
| 17 |
String ID = TIGERSection.class.getSimpleName(); |
|
| 18 |
|
|
| 19 |
private static final int SECTION_SIZE = 1; |
|
| 20 |
|
|
| 21 |
/** |
|
| 22 |
* |
|
| 23 |
* @param toolkit2 |
|
| 24 |
* @param form2 |
|
| 25 |
* @param parent |
|
| 26 |
* @param stylesave |
|
| 27 |
* |
|
| 28 |
* @param moduleParams |
|
| 29 |
* @param scriptName temporary parameter to detect if import module is xtzLoader.groovy |
|
| 30 |
*/ |
|
| 31 |
public TIGERSection(FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style) {
|
|
| 32 |
|
|
| 33 |
super(toolkit2, form2, parent, style, "TIGERSearch"); |
|
| 34 |
|
|
| 35 |
TableWrapLayout layout = new TableWrapLayout(); |
|
| 36 |
layout.makeColumnsEqualWidth = true; |
|
| 37 |
layout.numColumns = 1; |
|
| 38 |
this.section.setLayout(layout); |
|
| 39 |
this.section.setLayoutData(getSectionGridData(SECTION_SIZE)); |
|
| 40 |
this.section.setEnabled(false); |
|
| 41 |
|
|
| 42 |
this.section.addExpansionListener(new ExpansionAdapter() {
|
|
| 43 |
|
|
| 44 |
@Override |
|
| 45 |
public void expansionStateChanged(ExpansionEvent e) {
|
|
| 46 |
form.layout(true); |
|
| 47 |
} |
|
| 48 |
}); |
|
| 49 |
|
|
| 50 |
// filesection.setDescription("Select how to find source files");
|
|
| 51 |
Composite sectionClient = toolkit.createComposite(this.section); |
|
| 52 |
TableWrapLayout slayout = new TableWrapLayout(); |
|
| 53 |
slayout.numColumns = 4; |
|
| 54 |
sectionClient.setLayout(slayout); |
|
| 55 |
this.section.setClient(sectionClient); |
|
| 56 |
|
|
| 57 |
// headPropertiesText = toolkit.createText(sectionClient, "UD head properties to project (comma separated list)", SWT.CHECK); |
|
| 58 |
// gdata2 = getButtonLayoutData(); |
|
| 59 |
// gdata2.colspan = 4; // one line |
|
| 60 |
// headPropertiesText.setLayoutData(gdata2); |
|
| 61 |
// |
|
| 62 |
// // build text edition or not button |
|
| 63 |
// depsPropertiesText = toolkit.createText(sectionClient, "UD deps properties to project (comma separated list)", SWT.CHECK); |
|
| 64 |
// gdata2 = getButtonLayoutData(); |
|
| 65 |
// gdata2.colspan = 4; // one line |
|
| 66 |
// depsPropertiesText.setLayoutData(gdata2); |
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
@Override |
|
| 70 |
public void updateFields(Project project) {
|
|
| 71 |
if (this.section.isDisposed()) return; |
|
| 72 |
if (project == null) return; |
|
| 73 |
|
|
| 74 |
Preferences customNode = project.getImportParameters().node("tigersearch");
|
|
| 75 |
// createPagesForSectionsButton.setSelection(customNode.getBoolean("create_section_pages", true)); //$NON-NLS-1$
|
|
| 76 |
// indexTranscriberMetadataButton.setSelection(customNode.getBoolean("ignoreTranscriberMetadata", true)); //$NON-NLS-1$
|
|
| 77 |
} |
|
| 78 |
|
|
| 79 |
@Override |
|
| 80 |
public boolean saveFields(Project project) {
|
|
| 81 |
if (this.section != null && !this.section.isDisposed()) {
|
|
| 82 |
|
|
| 83 |
Preferences customNode = project.getImportParameters().node("tigersearch");
|
|
| 84 |
// customNode.putBoolean("create_section_pages", createPagesForSectionsButton.getSelection()); //$NON-NLS-1$
|
|
| 85 |
// customNode.putBoolean("ignoreTranscriberMetadata", indexTranscriberMetadataButton.getSelection()); //$NON-NLS-1$
|
|
| 86 |
} |
|
| 87 |
return true; |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
@Override |
|
| 91 |
public boolean checkFields() {
|
|
| 92 |
return true; |
|
| 93 |
} |
|
| 94 |
|
|
| 95 |
@Override |
|
| 96 |
public int getSectionSize() {
|
|
| 97 |
return SECTION_SIZE; |
|
| 98 |
} |
|
| 99 |
} |
|
| 0 | 100 | |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 3300) | ||
|---|---|---|
| 2 | 2 |
|
| 3 | 3 |
import java.io.File; |
| 4 | 4 |
import java.nio.MappedByteBuffer; |
| 5 |
import java.util.ArrayList; |
|
| 5 | 6 |
import java.util.Arrays; |
| 6 | 7 |
import java.util.List; |
| 7 | 8 |
|
| ... | ... | |
| 97 | 98 |
|
| 98 | 99 |
if (tsresult.getNumberOfMatch() == 0) return false; |
| 99 | 100 |
|
| 100 |
tsresult.setDisplayProperties(Arrays.asList(T), NT);
|
|
| 101 |
tsresult.setDisplayProperties(new ArrayList<>(Arrays.asList(T)), NT);
|
|
| 101 | 102 |
|
| 102 | 103 |
try {
|
| 103 | 104 |
// iterate to the sub th subgraph |
| ... | ... | |
| 117 | 118 |
} |
| 118 | 119 |
|
| 119 | 120 |
public String[] getAvailableTProperties() {
|
| 121 |
|
|
| 120 | 122 |
if (tscorpus == null) return new String[0]; |
| 121 | 123 |
List<String> tFeatures = tscorpus.getTFeatures(); |
| 122 | 124 |
return tFeatures.toArray(new String[tFeatures.size()]); |
| 123 | 125 |
} |
| 124 | 126 |
|
| 125 | 127 |
public String[] getAvailableNTProperties() {
|
| 128 |
|
|
| 126 | 129 |
if (tscorpus == null) return new String[0]; |
| 127 | 130 |
List<String> ntFeatures = tscorpus.getNTFeatures(); |
| 128 | 131 |
return ntFeatures.toArray(new String[ntFeatures.size()]); |
| ... | ... | |
| 319 | 322 |
|
| 320 | 323 |
return textAndWord; |
| 321 | 324 |
} |
| 325 |
|
|
| 326 |
@Override |
|
| 327 |
public String getIconPath() {
|
|
| 328 |
|
|
| 329 |
return "platform:/plugin/org.txm.tigersearch.rcp/icons/functions/TS.png"; |
|
| 330 |
} |
|
| 322 | 331 |
} |
| TXM/trunk/org.txm.tigersearch.rcp/plugin.xml (revision 3300) | ||
|---|---|---|
| 139 | 139 |
<extension |
| 140 | 140 |
point="org.eclipse.ui.preferencePages"> |
| 141 | 141 |
<page |
| 142 |
category="org.txm.rcp.preferences.UserPreferencePage"
|
|
| 142 |
category="org.txm.treesearch.preferences.TreeSearchPreferencePage"
|
|
| 143 | 143 |
class="org.txm.tigersearch.rcp.preferences.TigerSearchPreferencePage" |
| 144 |
id="org.txm.tigersearch.rcp.preferences.TreeSearchPreferencePage"
|
|
| 144 |
id="org.txm.tigersearch.rcp.preferences.TigerSearchPreferencePage"
|
|
| 145 | 145 |
name="TIGERSearch"> |
| 146 | 146 |
</page> |
| 147 | 147 |
</extension> |
| TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editors/imports/sections/AnnotationSection.java (revision 3300) | ||
|---|---|---|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
@Override |
| 59 |
public void update(Project project) {
|
|
| 59 |
public void updateFields(Project project) {
|
|
| 60 | 60 |
if (this.section.isDisposed()) return; |
| 61 | 61 |
if (project == null) return; |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 | 64 |
@Override |
| 65 |
public boolean save(Project project) {
|
|
| 65 |
public boolean saveFields(Project project) {
|
|
| 66 | 66 |
if (!this.section.isDisposed()) {
|
| 67 | 67 |
String value = nameText.getText(); |
| 68 | 68 |
|
| TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/DoInstallStep.java (revision 3300) | ||
|---|---|---|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
File macroDirectory = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/macro/analec"); //$NON-NLS-1$ |
| 62 |
if (!BundleUtils.copyFiles("org.txm.annotation.urs.rcp", "src", "org/txm/macro/", "urs", macroDirectory)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 62 |
if (!BundleUtils.copyFiles("org.txm.annotation.urs.rcp", "src", "org/txm/macro/", "urs", macroDirectory, true)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 63 | 63 |
System.out.println(NLS.bind(Messages.DoInstallStep_17, macroDirectory.getAbsolutePath())); |
| 64 | 64 |
return; |
| 65 | 65 |
} |
| TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java (revision 3300) | ||
|---|---|---|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
String bundle_id = "org.txm.annotation.urs.rcp"; |
| 62 |
BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory); |
|
| 62 |
BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory, true);
|
|
| 63 | 63 |
|
| 64 | 64 |
// saving current version |
| 65 | 65 |
// URSPreferences.getInstance().put(URSPreferences.VERSION, currentVersion.toString()); |
| TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/search/URSSearchEngine.java (revision 3300) | ||
|---|---|---|
| 104 | 104 |
static ArrayList<Element> findAllInCorpus(int debug, Corpus analecCorpus, CorpusBuild corpus, String URSQL) {
|
| 105 | 105 |
String[] params = getFilterParameters(URSQL); |
| 106 | 106 |
if (debug >= 2) Log.finer("PARAMS=$params");
|
| 107 |
return findAllInCorpus(debug, analecCorpus, corpus, params[0], params[1], params[2], Boolean.parseBoolean(params[3]), params[4]);
|
|
| 107 |
return findAllInCorpus(debug, analecCorpus, corpus, params[0], params[1], params[3], Boolean.parseBoolean(params[2]), params[4]);
|
|
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 | 110 |
static ArrayList<Element> findAllInCorpus(int debug, Corpus analecCorpus, CorpusBuild corpus, String clazzString, String typeRegex, String propName, boolean valueMustMatch, String valueRegex) {
|
| TXM/trunk/org.txm.connlu.core/plugin.xml (revision 3300) | ||
|---|---|---|
| 4 | 4 |
<extension |
| 5 | 5 |
point="org.txm.PostTXMHOMEInstallationStep"> |
| 6 | 6 |
<PostTXMHOMEInstallationStep |
| 7 |
class="org.txm.ud.core.InstallGroovyUDFiles"
|
|
| 7 |
class="org.txm.conllu.core.InstallGroovyCoNLLUFiles"
|
|
| 8 | 8 |
description="copy scripts for import module" |
| 9 |
name="UDFiles">
|
|
| 9 |
name="CoNLLUFiles">
|
|
| 10 | 10 |
</PostTXMHOMEInstallationStep> |
| 11 | 11 |
</extension> |
| 12 | 12 |
<extension |
| 13 | 13 |
point="org.txm.treesearch.TreeSearchSelector"> |
| 14 | 14 |
<TreeSearchSelector |
| 15 |
class="org.txm.ud.function.UDTreeSearchSelector">
|
|
| 15 |
class="org.txm.conllu.core.function.UDTreeSearchSelector">
|
|
| 16 | 16 |
</TreeSearchSelector> |
| 17 | 17 |
</extension> |
| 18 | 18 |
<extension |
| 19 | 19 |
point="org.eclipse.core.runtime.preferences"> |
| 20 | 20 |
<initializer |
| 21 |
class="org.txm.ud.preferences.UDPreferences">
|
|
| 21 |
class="org.txm.conllu.core.preferences.UDPreferences">
|
|
| 22 | 22 |
</initializer> |
| 23 | 23 |
</extension> |
| 24 | 24 |
|
| TXM/trunk/org.txm.connlu.core/META-INF/MANIFEST.MF (revision 3300) | ||
|---|---|---|
| 1 | 1 |
Manifest-Version: 1.0 |
| 2 | 2 |
Automatic-Module-Name: org.txm.connlu.core |
| 3 |
Bundle-SymbolicName: org.txm.ud.core;singleton:=true
|
|
| 4 |
Export-Package: org.txm.ud.core,
|
|
| 5 |
org.txm.ud.function,
|
|
| 6 |
org.txm.ud.preferences
|
|
| 7 |
Bundle-Name: CONNLU
|
|
| 3 |
Bundle-SymbolicName: org.txm.conllu.core;singleton:=true
|
|
| 4 |
Export-Package: org.txm.conllu.core,
|
|
| 5 |
org.txm.conllu.core.function,
|
|
| 6 |
org.txm.conllu.core.preferences
|
|
| 7 |
Bundle-Name: org.txm.conllu.core
|
|
| 8 | 8 |
Bundle-Version: 1.0.0.qualifier |
| 9 |
Require-Bundle: org.txm.core;bundle-version="0.8.0";visibility:=reexport,
|
|
| 9 |
Require-Bundle: org.txm.core;visibility:=reexport, |
|
| 10 | 10 |
org.txm.groovy.core;bundle-version="1.0.0";visibility:=reexport, |
| 11 | 11 |
org.txm.treesearch.core;bundle-version="1.0.0";visibility:=reexport, |
| 12 | 12 |
org.txm.libs.deptreeviz;bundle-version="0.3.0";visibility:=reexport, |
| TXM/trunk/org.txm.connlu.core/.project (revision 3300) | ||
|---|---|---|
| 1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 |
<projectDescription> |
| 3 |
<name>org.txm.ud.core</name>
|
|
| 3 |
<name>org.txm.conllu.core</name>
|
|
| 4 | 4 |
<comment></comment> |
| 5 | 5 |
<projects> |
| 6 | 6 |
</projects> |
| TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/conlluLoader.groovy (revision 3300) | ||
|---|---|---|
| 1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
| 2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
| 3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
| 4 |
// Sophia Antipolis, University of Paris 3. |
|
| 5 |
// |
|
| 6 |
// The TXM platform is free software: you can redistribute it |
|
| 7 |
// and/or modify it under the terms of the GNU General Public |
|
| 8 |
// License as published by the Free Software Foundation, |
|
| 9 |
// either version 2 of the License, or (at your option) any |
|
| 10 |
// later version. |
|
| 11 |
// |
|
| 12 |
// The TXM platform is distributed in the hope that it will be |
|
| 13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
| 14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
| 15 |
// PURPOSE. See the GNU General Public License for more |
|
| 16 |
// details. |
|
| 17 |
// |
|
| 18 |
// You should have received a copy of the GNU General |
|
| 19 |
// Public License along with the TXM platform. If not, see |
|
| 20 |
// http://www.gnu.org/licenses. |
|
| 21 |
// |
|
| 22 |
// |
|
| 23 |
// |
|
| 24 |
// $LastChangedDate: 2015-06-03 15:04:53 +0200 (mer., 03 juin 2015) $ |
|
| 25 |
// $LastChangedRevision: 2984 $ |
|
| 26 |
// $LastChangedBy: mdecorde $ |
|
| 27 |
// |
|
| 28 |
package org.txm.scripts.importer.conllu; |
|
| 29 |
|
|
| 30 |
import javax.xml.stream.* |
|
| 31 |
|
|
| 32 |
import org.txm.* |
|
| 33 |
import org.txm.metadatas.* |
|
| 34 |
import org.txm.objects.* |
|
| 35 |
import org.txm.importer.scripts.xmltxm.* |
|
| 36 |
import org.txm.utils.* |
|
| 37 |
import org.txm.utils.i18n.* |
|
| 38 |
import org.txm.importer.xtz.* |
|
| 39 |
|
|
| 40 |
String userDir = System.getProperty("user.home");
|
|
| 41 |
|
|
| 42 |
def MONITOR; |
|
| 43 |
Project project; |
|
| 44 |
|
|
| 45 |
try {project=projectBinding;MONITOR=monitor} catch (Exception)
|
|
| 46 |
{ }
|
|
| 47 |
if (project == null) { println "no project set. Aborting"; return; }
|
|
| 48 |
CoNLLUImport i = new CoNLLUImport(project); |
|
| 49 |
/* |
|
| 50 |
* To customize the XTZ import, replace the importer, compiler, annotater or pager objects before calling process() |
|
| 51 |
i.importer = new XTZImporter(i) |
|
| 52 |
i.compiler = new XTZCompiler(i) |
|
| 53 |
i.annotater = new TTAnnotater(i); |
|
| 54 |
i.pager = new XTZPager(i) |
|
| 55 |
*/ |
|
| 56 |
i.process(); |
|
| 57 |
readyToLoad = i.isSuccessful && project.save() |
|
| TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImport.groovy (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.scripts.importer.conllu; |
|
| 2 |
|
|
| 3 |
import java.io.File; |
|
| 4 |
import java.util.ArrayList; |
|
| 5 |
|
|
| 6 |
import ims.tiger.index.writer.* |
|
| 7 |
import ims.tiger.system.* |
|
| 8 |
|
|
| 9 |
import org.txm.Toolbox; |
|
| 10 |
import org.txm.importer.ApplyXsl2; |
|
| 11 |
import org.txm.importer.xtz.* |
|
| 12 |
import org.txm.objects.Project |
|
| 13 |
import org.txm.utils.BundleUtils; |
|
| 14 |
import org.txm.utils.io.FileCopy; |
|
| 15 |
import org.txm.utils.io.IOUtils |
|
| 16 |
import org.apache.log4j.BasicConfigurator; |
|
| 17 |
import org.txm.importer.xtz.* |
|
| 18 |
import org.txm.scripts.importer.xtz.* |
|
| 19 |
import org.txm.scripts.importer.tigersearch.TSImport |
|
| 20 |
import org.txm.utils.* |
|
| 21 |
import org.txm.searchengine.ts.TIGERSearchEngine |
|
| 22 |
|
|
| 23 |
class CoNLLUImport extends XTZImport {
|
|
| 24 |
|
|
| 25 |
public CoNLLUImport(Project params) {
|
|
| 26 |
super(params); |
|
| 27 |
} |
|
| 28 |
|
|
| 29 |
@Override |
|
| 30 |
public void init(Project p) {
|
|
| 31 |
super.init(p); |
|
| 32 |
|
|
| 33 |
importer = new CoNLLUImporter(this); |
|
| 34 |
compiler = new XTZCompiler(this) |
|
| 35 |
annotater = null; // no annotater step to do |
|
| 36 |
pager = new XTZPager(this) |
|
| 37 |
} |
|
| 38 |
|
|
| 39 |
/** |
|
| 40 |
* Do a XTZ Import then build the TIGERSearch indexes in the binary corpus "tiger" directory |
|
| 41 |
*/ |
|
| 42 |
@Override |
|
| 43 |
public void start() throws InterruptedException {
|
|
| 44 |
|
|
| 45 |
super.start(); // call the usual XTZ import |
|
| 46 |
|
|
| 47 |
// build the TIGER-XML file |
|
| 48 |
new CallUD2TigerPerlScript().convertCoNLLUFiles(this.sourceDirectory.getAbsolutePath(), this.binaryDirectory.getAbsolutePath()) |
|
| 49 |
|
|
| 50 |
|
|
| 51 |
File tigerXMLDirectory = new File(this.binaryDirectory, "tiger-xml") |
|
| 52 |
|
|
| 53 |
File xslfile1 = BundleUtils.getFile("org.txm.conllu.core", "groovy", "/org/txm/scripts/importer/conllu/", "tigerXml-commentOutLongSentences.xsl")
|
|
| 54 |
File xslfile2 = BundleUtils.getFile("org.txm.conllu.core", "groovy", "/org/txm/scripts/importer/conllu/", "tigerXml-sortBfmByDate.xsl")
|
|
| 55 |
|
|
| 56 |
ApplyXsl2 a1 = new ApplyXsl2(xslfile1); |
|
| 57 |
ApplyXsl2 a2 = new ApplyXsl2(xslfile2); |
|
| 58 |
for (File xmlFile : tigerXMLDirectory.listFiles()) {
|
|
| 59 |
if (!xmlFile.getName().endsWith(".xml")) continue;
|
|
| 60 |
File xmlFileTmp = new File(xmlFile.getAbsolutePath()+".tmp") |
|
| 61 |
if (!(a1.process(xmlFile, xmlFileTmp) && xmlFile.delete() && xmlFileTmp.renameTo(xmlFile))) {
|
|
| 62 |
println "Error while applying $xslfile1 to $xmlFile" |
|
| 63 |
} |
|
| 64 |
|
|
| 65 |
if (!(a2.process(xmlFile, xmlFileTmp) && xmlFile.delete() && xmlFileTmp.renameTo(xmlFile))) {
|
|
| 66 |
println "Error while applying $xslfile2 to $xmlFile" |
|
| 67 |
} |
|
| 68 |
} |
|
| 69 |
|
|
| 70 |
// build TIGER indexes |
|
| 71 |
if (isSuccessful) {
|
|
| 72 |
// read from the 'tiger-xml' and write to the 'tiger' directory |
|
| 73 |
TIGERSearchEngine.buildTIGERCorpus(tigerXMLDirectory, this.binaryDirectory, corpusName); |
|
| 74 |
} |
|
| 75 |
} |
|
| 76 |
} |
|
| TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CallUD2TigerPerlScript.groovy (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.scripts.importer.conllu |
|
| 2 |
|
|
| 3 |
import org.txm.utils.* |
|
| 4 |
|
|
| 5 |
def convertCoNLLUFiles(def input_directory_path, def output_directory) {
|
|
| 6 |
|
|
| 7 |
def input_directory = new File(input_directory_path) |
|
| 8 |
|
|
| 9 |
if (input_directory_path.length() == 0 && input_directory.canRead()) {
|
|
| 10 |
println "** impossible to access directory $input_directory. Aborting." |
|
| 11 |
return false |
|
| 12 |
} |
|
| 13 |
|
|
| 14 |
def tigerXMLDirectory = new File(output_directory, "tiger-xml") |
|
| 15 |
def conversionFile = new File(tigerXMLDirectory, "conversion.log") |
|
| 16 |
def mainFullFile = new File(tigerXMLDirectory, "main-full.xml") |
|
| 17 |
def mainFile = new File(tigerXMLDirectory, "main.xml") |
|
| 18 |
def perlScript = BundleUtils.getFile("org.txm.conllu.core", "groovy", "/org/txm/scripts/importer/conllu/", "conll2tiger-ud.pl")
|
|
| 19 |
|
|
| 20 |
tigerXMLDirectory.deleteDir() |
|
| 21 |
//println "clean&mkdir $tigerXMLDirectory" |
|
| 22 |
tigerXMLDirectory.mkdir() |
|
| 23 |
|
|
| 24 |
//println "Converting..." |
|
| 25 |
|
|
| 26 |
def subcorpusList = "" |
|
| 27 |
for (def f : input_directory.listFiles()) {
|
|
| 28 |
|
|
| 29 |
if (!f.getName().endsWith(".conllu")) {
|
|
| 30 |
continue |
|
| 31 |
} |
|
| 32 |
|
|
| 33 |
try {
|
|
| 34 |
println "$f... "+"perl '$perlScript' -s 10000 -o '$tigerXMLDirectory' '$f'" |
|
| 35 |
def p = ["perl", "$perlScript", "-s", "10000", "-o", "$tigerXMLDirectory", "$f"].execute() |
|
| 36 |
def sout = new StringBuilder(), serr = new StringBuilder() |
|
| 37 |
p.consumeProcessOutput(sout, serr) |
|
| 38 |
p.waitFor() |
|
| 39 |
|
|
| 40 |
subcorpusList += mainFile.readLines("UTF-8").findAll() {it.contains("<subcorpus ")}.join("\n") // tiger-xml/main.xml >> tiger-xml/subcorpus-list
|
|
| 41 |
} catch (Throwable t) { println "Error: $t" }
|
|
| 42 |
} |
|
| 43 |
|
|
| 44 |
// println "subcorpus-list: "+subcorpusList |
|
| 45 |
mainFullFile.setText(mainFile.getText().replaceAll("<subcorpus .+</subcorpus>", subcorpusList))
|
|
| 46 |
|
|
| 47 |
conversionFile.delete() |
|
| 48 |
mainFullFile.renameTo(mainFile) |
|
| 49 |
|
|
| 50 |
//println "Done." |
|
| 51 |
return true |
|
| 52 |
} |
|
| TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/tigerXml-commentOutLongSentences.xsl (revision 3300) | ||
|---|---|---|
| 1 |
<!-- The Identity Transformation --> |
|
| 2 |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|
| 3 |
|
|
| 4 |
<!-- This stylesheet comments out the sentences containing more than 100 terminal nodes in Tiger XML files. |
|
| 5 |
To change the theshold, puse the maxLength parameter. |
|
| 6 |
|
|
| 7 |
Written by A. Lavrentiev, CNRS, UMR IHRIM 2021-07-16 |
|
| 8 |
Licence: GNU GPL v.3 |
|
| 9 |
--> |
|
| 10 |
|
|
| 11 |
<!-- Whenever you match any node or any attribute --> |
|
| 12 |
<xsl:template match="node()|@*"> |
|
| 13 |
<!-- Copy the current node --> |
|
| 14 |
<xsl:copy> |
|
| 15 |
<!-- Including any attributes it has and any child nodes --> |
|
| 16 |
<xsl:apply-templates select="@*|node()"/> |
|
| 17 |
</xsl:copy> |
|
| 18 |
</xsl:template> |
|
| 19 |
|
|
| 20 |
<xsl:param name="maxLength" as="xs:integer">100</xsl:param> |
|
| 21 |
|
|
| 22 |
<xsl:template match="s"> |
|
| 23 |
<xsl:choose> |
|
| 24 |
<xsl:when test="count(graph/terminals/t) gt $maxLength"> |
|
| 25 |
<xsl:comment> |
|
| 26 |
Sentence too long (<xsl:value-of select="count(graph/terminals/t)"/> tokens) : |
|
| 27 |
<xsl:for-each select="graph/terminals/t"><xsl:value-of select="@word"/><xsl:text> </xsl:text></xsl:for-each> |
|
| 28 |
</xsl:comment> |
|
| 29 |
</xsl:when> |
|
| 30 |
<xsl:otherwise> |
|
| 31 |
<xsl:copy-of select="."/> |
|
| 32 |
</xsl:otherwise> |
|
| 33 |
</xsl:choose> |
|
| 34 |
</xsl:template> |
|
| 35 |
|
|
| 36 |
</xsl:stylesheet> |
|
| 0 | 37 | |
| TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy (revision 3300) | ||
|---|---|---|
| 1 |
package org.txm.scripts.importer.conllu |
|
| 2 |
|
|
| 3 |
import org.txm.Toolbox |
|
| 4 |
import org.txm.importer.xtz.ImportModule; |
|
| 5 |
import org.txm.metadatas.Metadatas |
|
| 6 |
import org.txm.utils.io.FileCopy |
|
| 7 |
import org.txm.utils.io.IOUtils |
|
| 8 |
import org.txm.importer.xtz.* |
|
| 9 |
import org.txm.scripts.importer.xtz.* |
|
| 10 |
import org.txm.conllu.core.function.ImportCoNLLUAnnotations |
|
| 11 |
import org.txm.conllu.core.preferences.UDPreferences |
|
| 12 |
import org.txm.importer.ApplyXsl2; |
|
| 13 |
import javax.xml.stream.* |
|
Formats disponibles : Unified diff