Révision 2992
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/commands/ExportCorpusAsCONNLU.java (revision 2992) | ||
---|---|---|
39 | 39 |
import org.eclipse.core.commands.ExecutionEvent; |
40 | 40 |
import org.eclipse.core.commands.ExecutionException; |
41 | 41 |
import org.eclipse.jface.viewers.IStructuredSelection; |
42 |
import org.eclipse.osgi.util.NLS; |
|
42 | 43 |
import org.eclipse.ui.handlers.HandlerUtil; |
43 | 44 |
import org.kohsuke.args4j.Option; |
44 | 45 |
import org.txm.rcp.swt.widget.parameters.ParametersDialog; |
... | ... | |
48 | 49 |
import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException; |
49 | 50 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
50 | 51 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
52 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
|
51 | 53 |
import org.txm.searchengine.cqp.corpus.WordProperty; |
52 | 54 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
53 | 55 |
import org.txm.searchengine.cqp.serverException.CqiServerError; |
... | ... | |
309 | 311 |
|
310 | 312 |
HashSet<Integer> paragraphsStartPositions = new HashSet<>(); |
311 | 313 |
if (insertParagraphs) { |
312 |
for (int position : mainCorpus.query(new CQLQuery("<p> [_.text_id=\"" + textIds[iText] + "\"]"), "textParagraphPositions", false).getStarts()) { |
|
313 |
paragraphsStartPositions.add(position); |
|
314 |
StructuralUnit p_struct = mainCorpus.getStructuralUnit("p"); |
|
315 |
if (p_struct == null) { |
|
316 |
Log.warning(NLS.bind("No 'p' structure found in the {0} CQP corpus. Paragraphs can't be inserted.", mainCorpus)); |
|
314 | 317 |
} |
318 |
else { |
|
319 |
for (int position : mainCorpus.query(new CQLQuery("<p> [_.text_id=\"" + textIds[iText] + "\"]"), "textParagraphPositions", false).getStarts()) { |
|
320 |
paragraphsStartPositions.add(position); |
|
321 |
} |
|
322 |
} |
|
315 | 323 |
} |
316 | 324 |
|
317 | 325 |
HashMap<Integer, String> sentidStartPositions = getNonUNDEFPositionsAndValues(mainCorpus, "ud-sentid"); |
... | ... | |
560 | 568 |
ArrayList<Integer> sentence = sentences.get(iSentence); |
561 | 569 |
|
562 | 570 |
int[] sentencePositions = new int[sentence.size()]; |
563 |
for (int p = 0; p < sentence.size(); p++) |
|
571 |
for (int p = 0; p < sentence.size(); p++) {
|
|
564 | 572 |
sentencePositions[p] = sentence.get(p); |
573 |
} |
|
565 | 574 |
|
566 | 575 |
String[] gap = null; |
567 | 576 |
if (detectGap && mainCorpus.getProperty("gap") != null) { |
... | ... | |
611 | 620 |
+ "\t" + xposValues[p] + "\t" + featsValues[p] + "\t" + headValues[p] + "\t" + deprelValues[p] |
612 | 621 |
+ "\t" + depsValues[p] + "\t" + miscValues[p]); |
613 | 622 |
|
614 |
if (gap != null && gap[ip].equals("next")) writer.println("# gap"); |
|
623 |
if (gap != null && gap[ip].equals("next")) { |
|
624 |
writer.println("# gap"); |
|
625 |
} |
|
615 | 626 |
} |
616 | 627 |
writer.println(""); |
617 | 628 |
numberOfSentencesWritten++; |
Formats disponibles : Unified diff