Révision 3687
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/Explorer.java (revision 3687) | ||
|---|---|---|
| 56 | 56 |
import org.eclipse.swt.widgets.MessageBox; |
| 57 | 57 |
import org.eclipse.swt.widgets.Text; |
| 58 | 58 |
import org.eclipse.swt.widgets.TreeItem; |
| 59 |
import org.eclipse.ui.IViewPart; |
|
| 60 |
import org.eclipse.ui.IWorkbenchPage; |
|
| 61 |
import org.eclipse.ui.PartInitException; |
|
| 59 | 62 |
import org.eclipse.ui.PlatformUI; |
| 60 | 63 |
import org.eclipse.ui.part.ViewPart; |
| 61 | 64 |
import org.txm.Toolbox; |
| ... | ... | |
| 128 | 131 |
explorerView.tv.refresh(f); |
| 129 | 132 |
} |
| 130 | 133 |
|
| 134 |
|
|
| 135 |
/** |
|
| 136 |
* Opens the Fiel Explorer |
|
| 137 |
*/ |
|
| 138 |
public static void open(File f) {
|
|
| 139 |
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); |
|
| 140 |
|
|
| 141 |
try {
|
|
| 142 |
IViewPart v = page.showView(Explorer.ID); |
|
| 143 |
if (f != null && v instanceof Explorer) {
|
|
| 144 |
Explorer e = (Explorer)v; |
|
| 145 |
if (f.isDirectory()) {
|
|
| 146 |
e.setRoot(f); |
|
| 147 |
} else {
|
|
| 148 |
e.setRoot(f.getParentFile()); |
|
| 149 |
} |
|
| 150 |
} |
|
| 151 |
} catch (PartInitException e) {
|
|
| 152 |
// TODO Auto-generated catch block |
|
| 153 |
e.printStackTrace(); |
|
| 154 |
} |
|
| 155 |
} |
|
| 156 |
|
|
| 157 |
/** |
|
| 158 |
* Opens the File Explorer |
|
| 159 |
*/ |
|
| 160 |
public static void open() {
|
|
| 161 |
open(null); |
|
| 162 |
} |
|
| 163 |
|
|
| 131 | 164 |
/* |
| 132 | 165 |
* (non-Javadoc) |
| 133 | 166 |
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java (revision 3687) | ||
|---|---|---|
| 27 | 27 |
// |
| 28 | 28 |
package org.txm.rcp.editors.imports; |
| 29 | 29 |
|
| 30 |
import java.io.File; |
|
| 30 | 31 |
import java.io.IOException; |
| 31 | 32 |
import java.lang.reflect.Constructor; |
| 32 | 33 |
import java.util.HashMap; |
| ... | ... | |
| 58 | 59 |
import org.eclipse.ui.forms.widgets.Section; |
| 59 | 60 |
import org.eclipse.ui.forms.widgets.TableWrapData; |
| 60 | 61 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
| 62 |
import org.txm.Toolbox; |
|
| 63 |
import org.txm.groovy.core.GSERunner; |
|
| 61 | 64 |
import org.txm.objects.Project; |
| 62 | 65 |
import org.txm.rcp.IImageKeys; |
| 63 | 66 |
import org.txm.rcp.commands.workspace.UpdateCorpus; |
| ... | ... | |
| 77 | 80 |
import org.txm.rcp.handlers.scripts.ExecuteImportScript; |
| 78 | 81 |
import org.txm.rcp.messages.TXMUIMessages; |
| 79 | 82 |
import org.txm.rcp.utils.SWTEditorsUtils; |
| 83 |
import org.txm.rcp.views.fileexplorer.Explorer; |
|
| 80 | 84 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
| 81 | 85 |
import org.txm.utils.logger.Log; |
| 82 | 86 |
import org.xml.sax.SAXException; |
| ... | ... | |
| 734 | 738 |
hyperlinks.setLayoutData(gdata); |
| 735 | 739 |
|
| 736 | 740 |
TableWrapLayout layout = new TableWrapLayout(); |
| 737 |
layout.numColumns = 4;
|
|
| 741 |
layout.numColumns = 5;
|
|
| 738 | 742 |
layout.makeColumnsEqualWidth = false; |
| 739 | 743 |
hyperlinks.setLayout(layout); |
| 740 | 744 |
|
| ... | ... | |
| 742 | 746 |
titleLabel.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP)); |
| 743 | 747 |
|
| 744 | 748 |
if (editor.project == null) {
|
| 745 |
titleLabel.setText(NLS.bind(TXMUIMessages.importParametersOfP0, editor.getImportName()));
|
|
| 749 |
titleLabel.setText(NLS.bind(TXMUIMessages.importParametersOfP0, ImportModuleCustomization.getName(editor.getImportName())));
|
|
| 746 | 750 |
} else {
|
| 747 |
titleLabel.setText(NLS.bind(TXMUIMessages.UpdateParametersForTheP0ImportModule, editor.getImportName()));
|
|
| 751 |
titleLabel.setText(NLS.bind(TXMUIMessages.UpdateParametersForTheP0ImportModule, ImportModuleCustomization.getName(editor.getImportName())));
|
|
| 748 | 752 |
} |
| 749 | 753 |
|
| 750 | 754 |
FontData[] fD = titleLabel.getFont().getFontData(); |
| ... | ... | |
| 793 | 797 |
} |
| 794 | 798 |
}; |
| 795 | 799 |
|
| 800 |
HyperlinkAdapter editImporScriptstListener = new HyperlinkAdapter() {
|
|
| 801 |
|
|
| 802 |
@Override |
|
| 803 |
public void linkActivated(HyperlinkEvent e) {
|
|
| 804 |
String scriptPath = editor.getImportName(); |
|
| 805 |
File rootDir = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/scripts/importer"); //$NON-NLS-1$ |
|
| 806 |
File scriptDir = new File(rootDir, scriptPath); |
|
| 807 |
Explorer.open(scriptDir); |
|
| 808 |
} |
|
| 809 |
}; |
|
| 810 |
|
|
| 796 | 811 |
if (editor.project == null) {
|
| 797 | 812 |
ImageHyperlink openImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
| 798 | 813 |
openImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
| 799 | 814 |
openImportLink.setImage(IImageKeys.getImage(IImageKeys.FOLDER)); |
| 815 |
openImportLink.setToolTipText("Select the import source directory");
|
|
| 800 | 816 |
openImportLink.addHyperlinkListener(selectDirHListener); |
| 801 | 817 |
} |
| 802 | 818 |
|
| 803 | 819 |
ImageHyperlink saveImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
| 804 | 820 |
saveImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
| 805 | 821 |
saveImportLink.setImage(IImageKeys.getImage(IImageKeys.SAVE)); |
| 822 |
saveImportLink.setToolTipText("Save the improt parameter");
|
|
| 806 | 823 |
saveImportLink.addHyperlinkListener(saveHListener); |
| 807 | 824 |
|
| 808 | 825 |
ImageHyperlink startImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
| 809 | 826 |
startImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
| 810 | 827 |
startImportLink.setImage(IImageKeys.getImage(IImageKeys.START)); |
| 828 |
startImportLink.setToolTipText("Start the import");
|
|
| 811 | 829 |
startImportLink.addHyperlinkListener(startImportListener); |
| 812 | 830 |
|
| 831 |
ImageHyperlink scriptImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
|
| 832 |
scriptImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
|
| 833 |
scriptImportLink.setImage(IImageKeys.getImage(IImageKeys.SCRIPT)); |
|
| 834 |
scriptImportLink.setToolTipText("Show the import Groovy scripts");
|
|
| 835 |
scriptImportLink.addHyperlinkListener(editImporScriptstListener); |
|
| 836 |
|
|
| 813 | 837 |
int n = 1; |
| 814 | 838 |
if (editor.project == null) {
|
| 815 | 839 |
|
| ... | ... | |
| 853 | 877 |
hyperlink3.setText(TXMUIMessages.StartCorpusUpdate); |
| 854 | 878 |
} |
| 855 | 879 |
hyperlink3.addHyperlinkListener(startImportListener); |
| 880 |
|
|
| 856 | 881 |
ImageHyperlink startImportLink2 = toolkit.createImageHyperlink(line4, SWT.NULL); |
| 857 | 882 |
startImportLink2.setImage(IImageKeys.getImage(IImageKeys.START)); |
| 858 | 883 |
startImportLink2.addHyperlinkListener(startImportListener); |
| 884 |
// |
|
| 885 |
// ImageHyperlink scriptImportLink2 = toolkit.createImageHyperlink(line4, SWT.NULL); |
|
| 886 |
// scriptImportLink2.setImage(IImageKeys.getImage(IImageKeys.SCRIPT)); |
|
| 887 |
// scriptImportLink2.addHyperlinkListener(editImporScriptstListener); |
|
| 859 | 888 |
} |
| 860 | 889 |
|
| 861 | 890 |
private int createUIsSection() {
|
| ... | ... | |
| 874 | 903 |
public void loadParams() throws ParserConfigurationException, SAXException, IOException {
|
| 875 | 904 |
|
| 876 | 905 |
Log.fine(NLS.bind(TXMUIMessages.moduleUIParametersColonP0, moduleParams)); |
| 877 |
this.setPartName(editor.project.getName());
|
|
| 906 |
this.setPartName(editor.getImportName());
|
|
| 878 | 907 |
|
| 879 | 908 |
if (infosSection != null && !infosSection.isDisposed()) {
|
| 880 | 909 |
infosSection.setEnabled(true); |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java (revision 3687) | ||
|---|---|---|
| 395 | 395 |
} |
| 396 | 396 |
} |
| 397 | 397 |
|
| 398 |
public static void addNewImportModuleConfiguration(String script, String name, HashMap<String, Boolean> params) {
|
|
| 399 |
sectionsPerImportModule.put(script, params); //$NON-NLS-1$ |
|
| 400 |
names.put(script, name); //$NON-NLS-1$ //$NON-NLS-2$ |
|
| 401 |
} |
|
| 402 |
|
|
| 398 | 403 |
public static String getName(String importscript) {
|
| 399 | 404 |
if (sectionsPerImportModule.containsKey(importscript)) {
|
| 400 | 405 |
return names.get(importscript); |
| 401 | 406 |
} |
| 402 | 407 |
if (sectionsPerImportModule.containsKey(importscript+"Loader.groovy")) { //$NON-NLS-1$
|
| 403 | 408 |
return names.get(importscript+"Loader.groovy"); //$NON-NLS-1$ |
| 404 |
}else {
|
|
| 409 |
} else {
|
|
| 405 | 410 |
return importscript; |
| 406 | 411 |
} |
| 407 | 412 |
} |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/ImportFormEditorInput.java (revision 3687) | ||
|---|---|---|
| 73 | 73 |
public String getName() {
|
| 74 | 74 |
|
| 75 | 75 |
if (scriptFile != null) {
|
| 76 |
String importName = scriptFile.getName(); |
|
| 77 |
if (importName.indexOf("Loader.groovy") > 0) {
|
|
| 78 |
importName = importName.substring(0, importName.indexOf("Loader.groovy"));
|
|
| 79 |
} |
|
| 80 |
return importName; |
|
| 76 |
return ImportModuleCustomization.getName(scriptFile.getName()); |
|
| 81 | 77 |
} else {
|
| 82 | 78 |
return ""; //$NON-NLS-1$ |
| 83 | 79 |
} |
| TXM/trunk/bundles/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImport.groovy (revision 3687) | ||
|---|---|---|
| 48 | 48 |
if (isSuccessful) {
|
| 49 | 49 |
|
| 50 | 50 |
File tigerXmlSrcDir = new File(binaryDirectory, "src") |
| 51 |
|
|
| 51 |
tigerXmlSrcDir.mkdirs() |
|
| 52 | 52 |
String driverFilename = TigerSearchPreferences.getInstance().getString(TigerSearchPreferences.DRIVER_FILENAME); |
| 53 | 53 |
|
| 54 |
File master = new File(tigerXmlSrcDir, driverFilename) |
|
| 54 |
File master = new File(tigerXmlSrcDir, driverFilename) // copy of the master file for later use if the corpus is updated or to get the text order
|
|
| 55 | 55 |
|
| 56 | 56 |
File srcmaster = new File(sourceDirectory, driverFilename) |
| 57 | 57 |
if (srcmaster.exists()) {
|
| ... | ... | |
| 67 | 67 |
|
| 68 | 68 |
//build the master file using the TIGER-XML files of sourceDirectory |
| 69 | 69 |
// if necesary converts a driver (with <corpus>) file into a subcorpus (with <subcorpus>file |
| 70 |
def xmlFiles = tigerXmlSrcDir.listFiles()
|
|
| 70 |
def xmlFiles = sourceDirectory.listFiles()
|
|
| 71 | 71 |
|
| 72 | 72 |
def featuresToSkips = TigerSearchPreferences.getInstance(). |
| 73 | 73 |
getProjectPreferenceValue(project, TigerSearchPreferences.FEATURE_VALUES_TO_IGNORE_IN_HEADER, |
| ... | ... | |
| 226 | 226 |
masterwriter.close() |
| 227 | 227 |
} |
| 228 | 228 |
|
| 229 |
TIGERSearchEngine.buildTIGERCorpus(tigerXmlSrcDir, this.binaryDirectory, corpusName);
|
|
| 229 |
TIGERSearchEngine.buildTIGERCorpus(sourceDirectory, this.binaryDirectory, corpusName);
|
|
| 230 | 230 |
} |
| 231 | 231 |
} |
| 232 | 232 |
|
| ... | ... | |
| 234 | 234 |
protected ArrayList<String> getTXMFilesOrder() {
|
| 235 | 235 |
|
| 236 | 236 |
String driverFilename = TigerSearchPreferences.getInstance().getString(TigerSearchPreferences.DRIVER_FILENAME); |
| 237 |
|
|
| 238 | 237 |
File srcDriverFile = new File(sourceDirectory, driverFilename) |
| 239 | 238 |
File binDriverFile = new File(binaryDirectory, "src/"+driverFilename) |
| 240 | 239 |
if (binDriverFile.exists()) {
|
| ... | ... | |
| 242 | 241 |
for (def s : new XmlSlurper().parse(binDriverFile).body.subcorpus) {
|
| 243 | 242 |
String name = ""+s.@external |
| 244 | 243 |
if (name.startsWith("file:")) {
|
| 245 |
orderedFiles << name.substring(5); |
|
| 244 |
orderedFiles << name.substring(5, name.length() - 4);
|
|
| 246 | 245 |
} |
| 247 | 246 |
} |
| 248 | 247 |
return orderedFiles |
| ... | ... | |
| 251 | 250 |
for (def s : new XmlSlurper().parse(srcDriverFile).body.subcorpus) {
|
| 252 | 251 |
String name = ""+s.@external |
| 253 | 252 |
if (name.startsWith("file:")) {
|
| 254 |
orderedFiles << name.substring(5); |
|
| 253 |
orderedFiles << name.substring(5, name.length() - 4);
|
|
| 255 | 254 |
} |
| 256 | 255 |
} |
| 257 | 256 |
return orderedFiles |
| TXM/trunk/bundles/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 3687) | ||
|---|---|---|
| 362 | 362 |
} |
| 363 | 363 |
}); |
| 364 | 364 |
|
| 365 |
if (xmlFiles == null) {
|
|
| 366 |
System.out.println("No master file found in: "+sourceDirectory);
|
|
| 367 |
return false; |
|
| 368 |
} |
|
| 365 | 369 |
master = xmlFiles[0]; |
| 366 | 370 |
} |
| 367 | 371 |
String uri = master.getAbsolutePath(); // TIGER corpus source root file |
| TXM/trunk/bundles/org.txm.conllu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy (revision 3687) | ||
|---|---|---|
| 27 | 27 |
class CoNLLUImporter extends XTZImporter {
|
| 28 | 28 |
|
| 29 | 29 |
public CoNLLUImporter(ImportModule module) {
|
| 30 |
super(module);
|
|
| 30 |
super(module) |
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
@Override |
| ... | ... | |
| 39 | 39 |
|
| 40 | 40 |
if (usenewdocid) {
|
| 41 | 41 |
conlluSrcDirectory = new File(outputDirectory.getParentFile().getParentFile(), "conllu") |
| 42 |
conlluSrcDirectory.deleteDir();
|
|
| 43 |
conlluSrcDirectory.mkdirs();
|
|
| 42 |
conlluSrcDirectory.deleteDir() |
|
| 43 |
conlluSrcDirectory.mkdirs() |
|
| 44 | 44 |
|
| 45 | 45 |
println "Convert CoNLL-U to XML-TEI..." |
| 46 | 46 |
if (!splitCoNLLUFiles(inputDirectory, conlluSrcDirectory, project)) {
|
| 47 |
return;
|
|
| 47 |
return |
|
| 48 | 48 |
} |
| 49 | 49 |
} |
| 50 | 50 |
File metadataFile = Metadatas.findMetadataFile(module.sourceDirectory) |
| 51 | 51 |
File srcDirectory = new File(outputDirectory.getParentFile().getParentFile(), "conllu2tei") |
| 52 |
srcDirectory.deleteDir();
|
|
| 53 |
srcDirectory.mkdirs();
|
|
| 52 |
srcDirectory.deleteDir() |
|
| 53 |
srcDirectory.mkdirs() |
|
| 54 | 54 |
|
| 55 |
if (metadataFile.exists()) {
|
|
| 55 |
if (metadataFile != null && metadataFile.exists()) {
|
|
| 56 | 56 |
File metadataFile2 = new File(srcDirectory, metadataFile.getName()) |
| 57 | 57 |
FileCopy.copy(metadataFile, metadataFile2) |
| 58 | 58 |
} |
| ... | ... | |
| 62 | 62 |
|
| 63 | 63 |
inputDirectory = srcDirectory // switch files source directory |
| 64 | 64 |
|
| 65 |
super.process();
|
|
| 65 |
super.process() |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
public static def splitCoNLLUFiles(File inputDirectory, File srcDirectory, def project) {
|
| ... | ... | |
| 81 | 81 |
cpb_texts.tick() |
| 82 | 82 |
|
| 83 | 83 |
if (!master.getName().endsWith(".conllu")) {
|
| 84 |
continue;
|
|
| 84 |
continue |
|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
String orig_text_id = FileUtils.stripExtension(master) |
| ... | ... | |
| 117 | 117 |
return false |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 |
|
|
| 121 |
|
|
| 122 | 120 |
def properties = Arrays.asList(ImportCoNLLUAnnotations.UD_PROPERTY_NAMES) |
| 123 | 121 |
|
| 124 | 122 |
String prefix = UDPreferences.getInstance().getProjectPreferenceValue(project, UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX)); |
| ... | ... | |
| 139 | 137 |
cpb_texts.tick() |
| 140 | 138 |
|
| 141 | 139 |
if (!master.getName().endsWith(".conllu")) {
|
| 142 |
continue;
|
|
| 140 |
continue |
|
| 143 | 141 |
} |
| 144 | 142 |
|
| 145 |
def content = []; // list of sentence
|
|
| 143 |
def content = [] // list of sentence |
|
| 146 | 144 |
|
| 147 |
String text_id = FileUtils.stripExtension(master);
|
|
| 148 |
String sent_id = "";
|
|
| 149 |
String par_id = "1";
|
|
| 150 |
def comments = []; // /text/par/sent
|
|
| 145 |
String text_id = FileUtils.stripExtension(master) |
|
| 146 |
String sent_id = "" |
|
| 147 |
String par_id = "1" |
|
| 148 |
def comments = [] // /text/par/sent |
|
| 151 | 149 |
def words = [] |
| 152 | 150 |
|
| 153 | 151 |
master.eachLine("UTF-8") { line ->
|
| ... | ... | |
| 165 | 163 |
def sentence = [par_id, sent_id, words, comments] |
| 166 | 164 |
content.add(sentence) |
| 167 | 165 |
|
| 168 |
sent_id = "";
|
|
| 169 |
par_id = "1";
|
|
| 170 |
comments = [];
|
|
| 166 |
sent_id = "" |
|
| 167 |
par_id = "1" |
|
| 168 |
comments = [] |
|
| 171 | 169 |
words = [] |
| 172 | 170 |
} |
| 173 | 171 |
|
| ... | ... | |
| 187 | 185 |
def sentence = [par_id, sent_id, words, comments] |
| 188 | 186 |
content.add(sentence) |
| 189 | 187 |
|
| 190 |
sent_id = "";
|
|
| 191 |
par_id = "1";
|
|
| 192 |
comments = [];
|
|
| 188 |
sent_id = "" |
|
| 189 |
par_id = "1" |
|
| 190 |
comments = [] |
|
| 193 | 191 |
words = [] |
| 194 | 192 |
} |
| 195 | 193 |
} |
| ... | ... | |
| 224 | 222 |
writer.writeCharacters("\n")
|
| 225 | 223 |
|
| 226 | 224 |
String current_par_id = null |
| 227 |
|
|
| 225 |
int wordCounter = 0 |
|
| 228 | 226 |
for (def sentence : content) { // for all paragraph of the current text
|
| 229 | 227 |
|
| 230 | 228 |
par_id = sentence[0] |
| ... | ... | |
| 236 | 234 |
if (current_par_id != null) {
|
| 237 | 235 |
writer.writeEndElement() // p |
| 238 | 236 |
} |
| 239 |
writer.writeStartElement ("p");
|
|
| 237 |
writer.writeStartElement ("p")
|
|
| 240 | 238 |
writer.writeAttribute("id", par_id)
|
| 241 | 239 |
writer.writeCharacters("\n")
|
| 242 | 240 |
|
| ... | ... | |
| 292 | 290 |
|
| 293 | 291 |
for (def word : words) {
|
| 294 | 292 |
|
| 295 |
def id = word["id"]
|
|
| 296 |
|
|
| 293 |
String id = null
|
|
| 294 |
wordCounter++ |
|
| 297 | 295 |
writer.writeStartElement ("w")
|
| 298 | 296 |
for (String p : word.keySet()) {
|
| 299 | 297 |
if (p == "feats") word[p] = "|"+word[p]+"|" |
| 298 |
if (p == "misc" && word[p].contains("XmlId=")) {
|
|
| 299 |
id = word[p].substring(word[p].indexOf("XmlId=") + 6)
|
|
| 300 |
if (id.contains("|")) { // more misc values after XmlId
|
|
| 301 |
id = id.substring(0, id.indexOf("|"));
|
|
| 302 |
} |
|
| 303 |
} |
|
| 300 | 304 |
//println "WORD="+word |
| 301 | 305 |
writer.writeAttribute(prefix+p, word[p]) |
| 302 | 306 |
} |
| 303 | 307 |
|
| 308 |
if (id != null) {
|
|
| 309 |
writer.writeAttribute("id", id)
|
|
| 310 |
} else {
|
|
| 311 |
writer.writeAttribute("id", "w_"+text_id+"_"+wordCounter)
|
|
| 312 |
} |
|
| 313 |
|
|
| 304 | 314 |
writer.writeCharacters(word["form"]) |
| 305 | 315 |
writer.writeEndElement() // w |
| 306 | 316 |
writer.writeCharacters(" ")
|
| TXM/trunk/bundles/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/discours/importer.groovy (revision 3687) | ||
|---|---|---|
| 90 | 90 |
def csvfile = Metadatas.findMetadataFile(srcDir); |
| 91 | 91 |
Metadatas metadatas; // text metadata |
| 92 | 92 |
|
| 93 |
println "Trying to read metadata from: "+csvfile |
|
| 93 |
|
|
| 94 | 94 |
if (csvfile != null && csvfile.exists()) {
|
| 95 |
println "Trying to read metadata from: "+csvfile |
|
| 95 | 96 |
File copy = new File(binDir, csvfile.getName()) |
| 96 | 97 |
if (!FileCopy.copy(csvfile, copy)) {
|
| 97 | 98 |
println "Error: could not create a copy of metadata file "+csvfile.getAbsoluteFile(); |
| TXM/trunk/bundles/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy (revision 3687) | ||
|---|---|---|
| 175 | 175 |
//get metadata values from CSV |
| 176 | 176 |
Metadatas metadatas // text metadata |
| 177 | 177 |
|
| 178 |
println "Trying to read metadata from: "+allMetadataFile |
|
| 178 |
|
|
| 179 | 179 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done() }
|
| 180 | 180 |
if (allMetadataFile != null && allMetadataFile.exists()) {
|
| 181 | 181 |
println " Metadata file found: "+allMetadataFile |
| TXM/trunk/bundles/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivaLoader.groovy (revision 3687) | ||
|---|---|---|
| 160 | 160 |
|
| 161 | 161 |
//get metadata values from CSV |
| 162 | 162 |
Metadatas metadatas; // text metadata |
| 163 |
println "Trying to read metadata from: "+allMetadataFile |
|
| 163 |
|
|
| 164 | 164 |
if (allMetadataFile != null && allMetadataFile.exists()) {
|
| 165 |
println "Trying to read metadata from: "+allMetadataFile |
|
| 165 | 166 |
File copy = new File(binDir, allMetadataFile.getName()) |
| 166 | 167 |
if (!FileCopy.copy(allMetadataFile, copy)) {
|
| 167 | 168 |
println "Error: could not create a copy of metadata file "+allMetadataFile.getAbsoluteFile(); |
| TXM/trunk/bundles/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/importer/XTZImporterMacro.groovy (revision 3687) | ||
|---|---|---|
| 231 | 231 |
//get metadatas values from CSV |
| 232 | 232 |
Metadatas metadatas; // text metadatas |
| 233 | 233 |
|
| 234 |
println "Trying to read metadata from: "+allMetadataFile |
|
| 234 |
|
|
| 235 | 235 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
|
| 236 | 236 |
if (allMetadataFile != null && allMetadataFile.exists()) {
|
| 237 |
println "Trying to read metadata from: "+allMetadataFile |
|
| 237 | 238 |
File copy = new File(binDir, allMetadataFile.getName()) |
| 238 | 239 |
if (!FileCopy.copy(allMetadataFile, copy)) {
|
| 239 | 240 |
println "Error: could not create a copy of metadata file "+allMetadataFile.getAbsoluteFile(); |
| TXM/trunk/bundles/org.txm.conllu.rcp/src/org/txm/conllu/rcp/importsection/CoNLLUAnnotationSectionConfigurator.java (revision 3687) | ||
|---|---|---|
| 1 | 1 |
package org.txm.conllu.rcp.importsection; |
| 2 | 2 |
|
| 3 |
import java.util.HashMap; |
|
| 4 |
|
|
| 3 | 5 |
import org.txm.rcp.editors.imports.ImportEditorSectionConfigurator; |
| 4 | 6 |
import org.txm.rcp.editors.imports.ImportModuleCustomization; |
| 5 | 7 |
|
| ... | ... | |
| 10 | 12 |
public void installSections() {
|
| 11 | 13 |
|
| 12 | 14 |
ImportModuleCustomization.addAdditionalSections("conllu", CoNLLUSection.class);
|
| 15 |
|
|
| 16 |
HashMap<String, Boolean> params = new HashMap<String, Boolean>(ImportModuleCustomization.getParameters("xtzLoader.groovy"));
|
|
| 17 |
params.put(ImportModuleCustomization.LANG, true); |
|
| 18 |
params.put(ImportModuleCustomization.XSLT, false); |
|
| 19 |
params.put(ImportModuleCustomization.WORDS, false); |
|
| 20 |
params.put(ImportModuleCustomization.ADVANCEDTOKENIZER, true); |
|
| 21 |
params.put(ImportModuleCustomization.EDITIONS_WORDSPERPAGE, true); |
|
| 22 |
params.put(ImportModuleCustomization.EDITIONS_PAGEELEMENT, false); |
|
| 23 |
params.put(ImportModuleCustomization.PATTRIBUTES, false); |
|
| 24 |
params.put(ImportModuleCustomization.SATTRIBUTES, false); |
|
| 25 |
params.put(ImportModuleCustomization.PREBUILD, false); |
|
| 26 |
params.put(ImportModuleCustomization.QUERIES, false); |
|
| 27 |
params.put(ImportModuleCustomization.UI, true); |
|
| 28 |
params.put(ImportModuleCustomization.TEXTUALPLANS, false); |
|
| 29 |
params.put(ImportModuleCustomization.STRUCTURES, false); |
|
| 30 |
params.put(ImportModuleCustomization.OPTIONS, true); |
|
| 31 |
ImportModuleCustomization.addNewImportModuleConfiguration("conlluLoader.groovy", "CoNLL-U + CSV", params); //$NON-NLS-1$
|
|
| 13 | 32 |
} |
| 14 | 33 |
} |
Formats disponibles : Unified diff