1 // Functions to write morpheme data to files
2 // Copyright © 2009 The University of Chicago
3 #include "exportwizard.h"
8 #include <Q3TextStream>
10 #include "MiniLexicon.h"
12 #include "CorpusWord.h"
13 #include "Signature.h"
19 #include "CorpusWordCollection.h"
20 #include "SignatureCollection.h"
21 #include "CompoundCollection.h"
22 #include "LinkerCollection.h"
23 #include "SuffixCollection.h"
24 #include "PrefixCollection.h"
25 #include "WordCollection.h"
26 #include "StemCollection.h"
28 void ExportWizard::exportAll()
30 QString projectName
= m_projectName
->text();
31 projectName
.replace( " ", "_" );
33 QDir
dir( m_outputDirectory
->text() );
34 dir
.mkdir( projectName
);
35 dir
.cd( projectName
);
37 QDir::setCurrent( dir
.path() );
39 if( m_markUpFlag
->isChecked() ||
40 m_bothFlag
->isChecked() )
46 if( m_brokenCorpusFlag
->isChecked() &&
47 m_pLexicon
->GetCorpus()->count() ) exportBrokenCorpus();
49 if( m_corpusWordsFlag
->isChecked() &&
50 m_pLexicon
->GetWords() &&
51 m_pLexicon
->GetWords()->GetCount() ) exportCorpusWords();
53 if( m_compoundsFlag
->isChecked() &&
54 m_pLexicon
->GetCompounds() &&
55 m_pLexicon
->GetCompounds()->GetCount() )
61 if( m_allWordsFlag
->isChecked() &&
62 m_pLexicon
->GetAllWords() &&
63 m_pLexicon
->GetAllWords()->count() ) exportAllWords();
65 if( m_allStemsFlag
->isChecked() &&
66 m_pLexicon
->GetAllStems() &&
67 m_pLexicon
->GetAllStems()->count() ) exportAllStems();
69 if( m_allSuffixesFlag
->isChecked() &&
70 m_pLexicon
->GetAllSuffixes() &&
71 m_pLexicon
->GetAllSuffixes()->count() ) exportAllSuffixes();
73 if( m_allSuffixSigsFlag
->isChecked() &&
74 m_pLexicon
->GetAllSuffixSigs() &&
75 m_pLexicon
->GetAllSuffixSigs()->count() ) exportAllSuffixSigs();
77 if( m_allPrefixesFlag
->isChecked() &&
78 m_pLexicon
->GetAllPrefixes() &&
79 m_pLexicon
->GetAllPrefixes()->count() ) exportAllPrefixes();
81 if( m_allPrefixSigsFlag
->isChecked() &&
82 m_pLexicon
->GetAllPrefixSigs() &&
83 m_pLexicon
->GetAllPrefixSigs()->count() ) exportAllPrefixSigs();
87 if( m_miniWordsFlag
->isChecked() ) exportMiniWords();
88 if( m_miniSignaturesFlag
->isChecked() ) exportMiniSignatures();
89 if( m_miniStemsFlag
->isChecked() ) exportMiniStems();
90 if( m_miniSuffixesFlag
->isChecked() ) exportMiniSuffixes();
91 if( m_miniPrefixesFlag
->isChecked() ) exportMiniPrefixes();
99 void ExportWizard::exportStyleSheet()
104 QString projectName
= m_projectName
->text();
105 projectName
.replace( " ", "_" );
107 file
= new QFile( projectName
+ ".css" );
108 if( file
->open( QIODevice::WriteOnly
) )
111 out
= new Q3TextStream( file
);
112 out
->setEncoding( Q3TextStream::Unicode
);
117 *out
<< "\tmargin : 0px 0px 0px 0px;\n";
118 *out
<< "\tpadding : 0px 0px 0px 0px;\n";
124 *out
<< "\tleft : 20px;\n";
125 *out
<< "\ttop : 20px;\n";
126 *out
<< "\tfont-family : Arial, Helvetica, sans-serif;\n";
127 *out
<< "\tfont-size : 16px;\n";
128 *out
<< "\tcolor : #FFFFFF;\n";
129 *out
<< "\tfont-weight : bold;\n";
130 *out
<< "\tline-height : 20px;\n";
136 *out
<< "\tleft : 20px;\n";
137 *out
<< "\tfont-family : Arial, Helvetica, sans-serif;\n";
138 *out
<< "\tfont-size : 12px;\n";
139 *out
<< "\tcolor : #FFFFFF;\n";
140 *out
<< "\tfont-weight : bold;\n";
141 *out
<< "\tline-height : 7px;\n";
147 *out
<< "\tfont-family : Verdana, Geneva, Arial, Helvetica, sans-serif;\n";
148 *out
<< "\tfont-size : 12px;\n";
154 *out
<< "\tcolor : #E2EAF1;\n";
155 *out
<< "\ttext-decoration : none;\n";
156 *out
<< "\tfont-weight : normal;\n";
160 *out
<< "A:HOVER.top\n";
162 *out
<< "\tcolor : #FFFF00;\n";
163 *out
<< "\ttext-decoration : underline;\n";
164 *out
<< "\tfont-weight : normal;\n";
168 *out
<< "A.bookmark\n";
170 *out
<< "\tfont-weight : normal;\n";
171 *out
<< "\ttext-decoration : none;\n";
175 *out
<< "A:HOVER.bookmark\n";
177 *out
<< "\tfont-weight : normal;\n";
178 *out
<< "\ttext-decoration : none;\n";
184 *out
<< "\tfont-weight : normal;\n";
185 *out
<< "\tcolor : #000000;\n";
186 *out
<< "\ttext-decoration : none;\n";
190 *out
<< "A:HOVER.data\n";
192 *out
<< "\tfont-weight : normal;\n";
193 *out
<< "\ttext-decoration : underline;\n";
194 *out
<< "\tcolor : #CC6600;\n";
200 *out
<< "\tcolor : #CC6600;\n";
201 *out
<< "\tfont-weight : bold;\n";
202 *out
<< "\ttext-decoration : none;\n";
208 *out
<< "\ttext-decoration : underline;\n";
209 *out
<< "\tfont-weight : bold;\n";
210 *out
<< "\tcolor : #5A6C7E;\n";
216 *out
<< "\tleft : 0px;\n";
217 *out
<< "\ttop : 0px;\n";
218 *out
<< "\twidth : 100%;\n";
219 *out
<< "\tbackground-color : #5A6C7E;\n";
220 *out
<< "\tborder-bottom : 2px solid #1B2025;\n";
221 *out
<< "\tpadding : 10px 10px 10px 10px;\n";
222 *out
<< "\tfont-family : Verdana, Geneva, Arial, Helvetica, sans-serif;\n";
223 *out
<< "\tfont-size : 10px;\n";
224 *out
<< "\tcolor : #FFFFFF;\n";
225 *out
<< "\tfont-weight : bold;\n";
231 *out
<< "\tleft : 0px;\n";
232 *out
<< "\ttop : 70px;\n";
233 *out
<< "\tfont-family : Verdana, Geneva, Arial, Helvetica, sans-serif;\n";
234 *out
<< "\tfont-size : 12px;\n";
235 *out
<< "\tpadding : 10px 10px 10px 10px;\n";
241 *out
<< "\tcolor : #1B2025;\n";
242 *out
<< "\tfont-size : 12px;\n";
243 *out
<< "\tfont-weight : bold;\n";
249 *out
<< "\tcolor : " + m_wordStyle
->paletteForegroundColor().name() + ";\n";
250 if( m_wordStyle
->font().bold() ) *out
<< "\tfont-weight : bold;\n";
251 if( m_wordStyle
->font().italic() ) *out
<< "\tfont-style : italic;\n";
257 *out
<< "\tcolor : " + m_stemStyle
->paletteForegroundColor().name() + ";\n";
258 if( m_stemStyle
->font().bold() ) *out
<< "\tfont-weight : bold;\n";
259 if( m_stemStyle
->font().italic() ) *out
<< "\tfont-style : italic;\n";
265 *out
<< "\tcolor : " + m_suffixStyle
->paletteForegroundColor().name() + ";\n";
266 if( m_suffixStyle
->font().bold() ) *out
<< "\tfont-weight : bold;\n";
267 if( m_suffixStyle
->font().italic() ) *out
<< "\tfont-style : italic;\n";
273 *out
<< "\tcolor : " + m_prefixStyle
->paletteForegroundColor().name() + ";\n";
274 if( m_prefixStyle
->font().bold() ) *out
<< "\tfont-weight : bold;\n";
275 if( m_prefixStyle
->font().italic() ) *out
<< "\tfont-style : italic;\n";
279 *out
<< ".signature\n";
281 *out
<< "\tcolor : " + m_signatureStyle
->paletteForegroundColor().name() + ";\n";
282 if( m_signatureStyle
->font().bold() ) *out
<< "\tfont-weight : bold;\n";
283 if( m_signatureStyle
->font().italic() ) *out
<< "\tfont-style : italic;\n";
287 *out
<< ".compound\n";
289 *out
<< "\tcolor : " + m_compoundStyle
->paletteForegroundColor().name() + ";\n";
290 if( m_compoundStyle
->font().bold() ) *out
<< "\tfont-weight : bold;\n";
291 if( m_compoundStyle
->font().italic() ) *out
<< "\tfont-style : italic;\n";
295 delete file
; file
= NULL
;
296 delete out
; out
= NULL
;
301 void ExportWizard::exportBrokenCorpus()
306 CCorpusWord
* pCorpusWord
;
308 StringToString
* filter
= m_pLexicon
->GetOutFilter();
312 QString fileName
= m_projectName
->text() + "_" + BROKEN_CORPUS_FILE_TITLE
,
315 bool do_not_link_words
= !m_allWordsFlag
->isChecked() || m_allWordsAnalyzedOnlyFlag
->isChecked();
317 fileName
.replace( " ", "_" );
319 // Write simple text file
320 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
322 file
= new QFile( fileName
+ ".txt" );
323 if( file
->open( QIODevice::WriteOnly
) )
326 out
= new Q3TextStream( file
);
327 out
->setEncoding( Q3TextStream::Unicode
);
329 for( QStringList::Iterator lineIt
= m_pLexicon
->GetCorpus()->begin(); lineIt
!= m_pLexicon
->GetCorpus()->end(); ++lineIt
)
331 QStringList line
= QStringList::split( " ", *lineIt
);
333 for( QStringList::Iterator wordIt
= line
.begin(); wordIt
!= line
.end(); ++wordIt
)
335 pCorpusWord
= m_pLexicon
->GetCorpusMap()->find( *wordIt
);
337 if( pCorpusWord
) *out
<< pCorpusWord
->Display( '+', filter
) << " ";
338 else *out
<< *wordIt
<< " ";
345 delete file
; file
= NULL
;
346 delete out
; out
= NULL
;
350 // Write mark-up file
351 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
353 file
= new QFile( fileName
+ ".html" );
354 if( file
->open( QIODevice::WriteOnly
) )
356 out
= new Q3TextStream( file
);
357 out
->setEncoding( Q3TextStream::Unicode
);
359 // Output html file stuff
360 *out
<< getHTMLHeader( m_projectName
->text(), BROKEN_CORPUS_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
362 for( QStringList::Iterator lineIt
= m_pLexicon
->GetCorpus()->begin(); lineIt
!= m_pLexicon
->GetCorpus()->end(); ++lineIt
)
364 if( (*lineIt
).length() == 0 ) continue;
366 QStringList line
= QStringList::split( " ", *lineIt
);
370 for( QStringList::Iterator wordIt
= line
.begin(); wordIt
!= line
.end(); ++wordIt
)
372 pCorpusWord
= m_pLexicon
->GetCorpusMap()->find( *wordIt
);
378 if( pCorpusWord
->Size() > 1 )
380 for( int i
= 1; i
< pCorpusWord
->Size(); i
++ )
382 // All but the last piece with following delimiter
383 pLParse
= pCorpusWord
->GetMorpheme(i
);
384 if( !pLParse
) continue;
386 word
+= getLParseText( pLParse
, TRUE
);
392 pLParse
= pCorpusWord
->GetMorpheme( pCorpusWord
->Size() );
393 if( pLParse
) word
+= getLParseText( pLParse
, TRUE
);
397 // If it's one piece we force mark it as a word
398 pLParse
= pCorpusWord
->GetMorpheme(1);
399 if( !pLParse
) continue;
401 url
= m_projectName
->text() + "_" + ALL_WORDS_FILE_TITLE
+ ".html";
402 url
.replace( " ", "_" );
403 word
+= getLParseText( pLParse
, TRUE
, do_not_link_words
, "word", url
);
410 *out
<< *wordIt
<< " ";
417 *out
<< getHTMLFooter();
420 delete file
; file
= NULL
;
421 delete out
; out
= NULL
;
427 void ExportWizard::exportCorpusWords()
432 CCorpusWord
* pCorpusWord
;
434 StringToString
* filter
= m_pLexicon
->GetOutFilter();
436 QMap
<QString
,int> fieldWidths
;
437 int width
, start
, end
, index
;
442 fileName
= m_projectName
->text() + "_" + CORPUS_WORDS_FILE_TITLE
;
444 fileName
.replace( " ", "_" );
446 // Write simple text file
447 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
449 file
= new QFile( fileName
+ ".txt" );
450 if( file
->open( QIODevice::WriteOnly
) )
455 if( m_corpusWordsUniformFieldWidthsFlag
->isChecked() )
457 if( m_corpusWordsColumnTitlesFlag
->isChecked() )
459 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
460 fieldWidths
[WORD_FIELD
] = WORD_FIELD_TITLE
.length();
461 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
462 fieldWidths
[MORPHS_COUNT_FIELD
] = MORPHS_COUNT_FIELD_TITLE
.length();
463 fieldWidths
[MORPHS_FIELD
] = MORPHS_FIELD_TITLE
.length();
466 m_pLexicon
->GetWords()->Sort(PARSE_SIZE
);
467 for( i
= 0; i
< m_pLexicon
->GetWords()->GetCount(); i
++ )
469 pCorpusWord
= m_pLexicon
->GetWords()->GetAtSort(i
);
471 if( m_corpusWordsLine
->text().find( INDEX_FIELD
) >= 0 )
473 width
= QString( "%1" ).arg(i
).length();
474 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
476 if( m_corpusWordsLine
->text().find( WORD_FIELD
) >= 0 )
478 width
= pCorpusWord
->Display( filter
).length();
479 if( width
> fieldWidths
[WORD_FIELD
] ) fieldWidths
[WORD_FIELD
] = width
;
481 if( m_corpusWordsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
483 width
= QString( "%1" ).arg( pCorpusWord
->GetCorpusCount() ).length();
484 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
486 if( m_corpusWordsLine
->text().find( MORPHS_COUNT_FIELD
) >= 0 )
488 width
= QString( "%1" ).arg( pCorpusWord
->Size() ).length();
489 if( width
> fieldWidths
[MORPHS_COUNT_FIELD
] ) fieldWidths
[MORPHS_COUNT_FIELD
] = width
;
491 if( m_corpusWordsLine
->text().find( MORPHS_FIELD
) >= 0 )
493 width
= getCorpusWordMorphsField( pCorpusWord
).length();
494 if( width
> fieldWidths
[MORPHS_FIELD
] ) fieldWidths
[MORPHS_FIELD
] = width
;
501 out
= new Q3TextStream( file
);
502 out
->setEncoding( Q3TextStream::Unicode
);
506 if( m_corpusWordsColumnTitlesFlag
->isChecked() )
510 line
= m_corpusWordsLine
->text();
512 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
514 while( line
.length() > 0 )
516 start
= line
.find( "%" );
524 *out
<< line
.left( start
);
525 line
= line
.mid( start
);
526 end
= line
.find( "%", 1 );
527 field
= line
.mid( 0, end
+ 1 );
529 if( field
== INDEX_FIELD
)
532 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
533 *out
<< INDEX_FIELD_TITLE
;
535 if( field
== WORD_FIELD
)
538 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[WORD_FIELD
] );
539 *out
<< WORD_FIELD_TITLE
;
541 if( field
== CORPUS_COUNT_FIELD
)
544 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
545 *out
<< CORPUS_COUNT_FIELD_TITLE
;
547 if( field
== MORPHS_COUNT_FIELD
)
550 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_COUNT_FIELD
] );
551 *out
<< MORPHS_COUNT_FIELD_TITLE
;
553 if( field
== MORPHS_FIELD
)
556 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_FIELD
] );
557 *out
<< MORPHS_FIELD_TITLE
;
560 line
= line
.mid( end
+ 1 );
567 // Sort appropriately
568 if( m_corpusWordsMorphemeCountSortFlag
->isChecked() ) m_pLexicon
->GetWords()->Sort(PARSE_SIZE
);
569 else if( m_corpusWordsCorpusCountSortFlag
->isChecked() ) m_pLexicon
->GetWords()->Sort(CORPUSCOUNT
);
570 else m_pLexicon
->GetWords()->Sort(KEY
);
572 // Output text file stuff
574 for( i
= 0; i
< m_pLexicon
->GetWords()->GetCount(); i
++ )
576 pCorpusWord
= m_pLexicon
->GetWords()->GetAtSort(i
);
578 if( m_corpusWordsAnalyzedOnlyFlag
->isChecked() && pCorpusWord
->Size() < 2 ) continue;
580 if( m_corpusWordsColumnTitlesFlag
->isChecked() ) *out
<< " ";
582 line
= m_corpusWordsLine
->text();
584 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
586 while( line
.length() > 0 )
588 start
= line
.find( "%" );
596 *out
<< line
.left( start
);
597 line
= line
.mid( start
);
598 end
= line
.find( "%", 1 );
599 field
= line
.mid( 0, end
+ 1 );
601 if( field
== INDEX_FIELD
)
604 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
607 if( field
== WORD_FIELD
)
610 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[WORD_FIELD
] );
611 *out
<< pCorpusWord
->Display( filter
);
613 if( field
== CORPUS_COUNT_FIELD
)
616 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
617 *out
<< pCorpusWord
->GetCorpusCount();
619 if( field
== MORPHS_COUNT_FIELD
)
622 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_COUNT_FIELD
] );
623 *out
<< pCorpusWord
->Size();
625 if( field
== MORPHS_FIELD
)
628 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_FIELD
] );
629 *out
<< getCorpusWordMorphsField( pCorpusWord
);
632 line
= line
.mid( end
+ 1 );
639 delete file
; file
= NULL
;
640 delete out
; out
= NULL
;
644 // Write mark-up file
645 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
647 file
= new QFile( fileName
+ ".html" );
648 if( file
->open( QIODevice::WriteOnly
) )
650 out
= new Q3TextStream( file
);
651 out
->setEncoding( Q3TextStream::Unicode
);
653 // Output html file stuff
654 *out
<< getHTMLHeader( m_projectName
->text(), CORPUS_WORDS_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
656 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
659 if( m_corpusWordsColumnTitlesFlag
->isChecked() )
661 *out
<< "\t\t\t\t<tr>\n";
663 line
= m_corpusWordsLine
->text();
665 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
667 while( line
.length() > 0 )
669 start
= line
.find( "%" );
670 if( start
< 0 ) break;
672 line
= line
.mid( start
);
673 end
= line
.find( "%", 1 );
674 field
= line
.mid( 0, end
+ 1 );
676 if( field
== INDEX_FIELD
)
678 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
680 if( field
== WORD_FIELD
)
682 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << WORD_FIELD_TITLE
<< "</span></td>\n";
684 if( field
== CORPUS_COUNT_FIELD
)
686 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
688 if( field
== MORPHS_COUNT_FIELD
)
690 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MORPHS_COUNT_FIELD_TITLE
<< "</span></td>\n";
692 if( field
== MORPHS_FIELD
)
694 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << MORPHS_FIELD_TITLE
<< "</span></td>\n";
697 line
= line
.mid( end
+ 1 );
700 *out
<< "\t\t\t\t</tr>\n";
704 // Sort appropriately
705 if( m_corpusWordsMorphemeCountSortFlag
->isChecked() ) m_pLexicon
->GetWords()->Sort(PARSE_SIZE
);
706 else if( m_corpusWordsCorpusCountSortFlag
->isChecked() ) m_pLexicon
->GetWords()->Sort(CORPUSCOUNT
);
707 else m_pLexicon
->GetWords()->Sort(KEY
);
710 // Output html file stuff
712 for( i
= 0; i
< m_pLexicon
->GetWords()->GetCount(); i
++ )
714 pCorpusWord
= m_pLexicon
->GetWords()->GetAtSort(i
);
716 if( m_corpusWordsAnalyzedOnlyFlag
->isChecked() && pCorpusWord
->Size() < 2 ) continue;
718 *out
<< "\t\t\t\t<tr>\n";
720 line
= m_corpusWordsLine
->text();
722 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
724 while( line
.length() > 0 )
726 start
= line
.find( "%" );
727 if( start
< 0 ) break;
729 line
= line
.mid( start
);
730 end
= line
.find( "%", 1 );
731 field
= line
.mid( 0, end
+ 1 );
733 if( field
== INDEX_FIELD
)
735 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << index
++ << "</td>\n";
737 if( field
== WORD_FIELD
)
739 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pCorpusWord
->Display( filter
) << "</td>\n";
741 if( field
== CORPUS_COUNT_FIELD
)
743 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << QString( "%1" ).arg( pCorpusWord
->GetCorpusCount() ) << "</td>\n";
745 if( field
== MORPHS_COUNT_FIELD
)
747 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << QString( "%1" ).arg( pCorpusWord
->Size() ) << "</td>\n";
749 if( field
== MORPHS_FIELD
)
751 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getCorpusWordMorphsField( pCorpusWord
, TRUE
) << "</td>\n";
754 line
= line
.mid( end
+ 1 );
757 *out
<< "\t\t\t\t</tr>\n";
759 if( index
% 20 == 0 )
761 *out
<< "\t\t\t\t<tr>\n";
762 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_corpusWordsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
763 *out
<< "\t\t\t\t</tr>\n";
767 *out
<< "\t\t\t</table>\n";
769 *out
<< getHTMLFooter();
772 delete file
; file
= NULL
;
773 delete out
; out
= NULL
;
779 void ExportWizard::exportCompounds()
784 CCompound
* pCompound
;
786 StringToString
* filter
= m_pLexicon
->GetOutFilter();
788 QMap
<QString
,int> fieldWidths
;
789 int width
, start
, end
, index
;
794 fileName
= m_projectName
->text() + "_" + COMPOUNDS_FILE_TITLE
,
795 projectName
= m_projectName
->text();
797 projectName
.replace( " ", "_" );
798 fileName
.replace( " ", "_" );
800 // Write simple text file
801 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
803 file
= new QFile( fileName
+ ".txt" );
804 if( file
->open( QIODevice::WriteOnly
) )
809 if( m_compoundsUniformFieldWidthsFlag
->isChecked() )
811 if( m_compoundsColumnTitlesFlag
->isChecked() )
813 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
814 fieldWidths
[COMPOUND_FIELD
] = COMPOUND_FIELD_TITLE
.length();
815 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
816 fieldWidths
[MORPHS_COUNT_FIELD
] = MORPHS_COUNT_FIELD_TITLE
.length();
817 fieldWidths
[MORPHS_FIELD
] = MORPHS_FIELD_TITLE
.length();
818 fieldWidths
[SUFFIXNESS_FIELD
] = SUFFIXNESS_FIELD_TITLE
.length();
819 fieldWidths
[PREFIXNESS_FIELD
] = PREFIXNESS_FIELD_TITLE
.length();
820 fieldWidths
[PARSE_FIELD
] = PARSE_FIELD_TITLE
.length();
823 m_pLexicon
->GetCompounds()->Sort(PARSE_SIZE
);
824 for( i
= 0; i
< m_pLexicon
->GetCompounds()->GetCount(); i
++ )
826 pCompound
= m_pLexicon
->GetCompounds()->GetAtSort(i
);
828 if( m_compoundsLine
->text().find( INDEX_FIELD
) >= 0 )
830 width
= QString( "%1" ).arg(i
).length();
831 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
833 if( m_compoundsLine
->text().find( COMPOUND_FIELD
) >= 0 )
835 width
= pCompound
->Display( filter
).length();
836 if( width
> fieldWidths
[COMPOUND_FIELD
] ) fieldWidths
[COMPOUND_FIELD
] = width
;
838 if( m_compoundsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
840 width
= QString( "%1" ).arg( pCompound
->GetCorpusCount() ).length();
841 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
843 if( m_compoundsLine
->text().find( MORPHS_COUNT_FIELD
) >= 0 )
845 width
= QString( "%1" ).arg( pCompound
->Size() ).length();
846 if( width
> fieldWidths
[MORPHS_COUNT_FIELD
] ) fieldWidths
[MORPHS_COUNT_FIELD
] = width
;
848 if( m_compoundsLine
->text().find( MORPHS_FIELD
) >= 0 )
850 width
= getCompoundMorphsField( pCompound
).length();
851 if( width
> fieldWidths
[MORPHS_FIELD
] ) fieldWidths
[MORPHS_FIELD
] = width
;
853 if( m_compoundsLine
->text().find( SUFFIXNESS_FIELD
) >= 0 )
855 width
= QString( "%1" ).arg( pCompound
->GetSuffixness() ).length();
856 if( width
> fieldWidths
[SUFFIXNESS_FIELD
] ) fieldWidths
[SUFFIXNESS_FIELD
] = width
;
858 if( m_compoundsLine
->text().find( PREFIXNESS_FIELD
) >= 0 )
860 width
= QString( "%1" ).arg( pCompound
->GetPrefixness() ).length();
861 if( width
> fieldWidths
[PREFIXNESS_FIELD
] ) fieldWidths
[PREFIXNESS_FIELD
] = width
;
863 if( m_compoundsLine
->text().find( PARSE_FIELD
) >= 0 )
865 width
= QString( "%1" ).arg( pCompound
->DisplayBestParse( filter
) ).length();
866 if( width
> fieldWidths
[PARSE_FIELD
] ) fieldWidths
[PARSE_FIELD
] = width
;
873 out
= new Q3TextStream( file
);
874 out
->setEncoding( Q3TextStream::Unicode
);
878 if( m_compoundsColumnTitlesFlag
->isChecked() )
882 line
= m_compoundsLine
->text();
884 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
886 while( line
.length() > 0 )
888 start
= line
.find( "%" );
896 *out
<< line
.left( start
);
897 line
= line
.mid( start
);
898 end
= line
.find( "%", 1 );
899 field
= line
.mid( 0, end
+ 1 );
901 if( field
== INDEX_FIELD
)
904 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
905 *out
<< INDEX_FIELD_TITLE
;
907 if( field
== COMPOUND_FIELD
)
910 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[COMPOUND_FIELD
] );
911 *out
<< COMPOUND_FIELD_TITLE
;
913 if( field
== CORPUS_COUNT_FIELD
)
916 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
917 *out
<< CORPUS_COUNT_FIELD_TITLE
;
919 if( field
== MORPHS_COUNT_FIELD
)
922 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_COUNT_FIELD
] );
923 *out
<< MORPHS_COUNT_FIELD_TITLE
;
925 if( field
== MORPHS_FIELD
)
928 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_FIELD
] );
929 *out
<< MORPHS_FIELD_TITLE
;
931 if( field
== SUFFIXNESS_FIELD
)
934 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIXNESS_FIELD
] );
935 *out
<< SUFFIXNESS_FIELD_TITLE
;
937 if( field
== PREFIXNESS_FIELD
)
940 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIXNESS_FIELD
] );
941 *out
<< PREFIXNESS_FIELD_TITLE
;
943 if( field
== PARSE_FIELD
)
946 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PARSE_FIELD
] );
947 *out
<< PARSE_FIELD_TITLE
;
950 line
= line
.mid( end
+ 1 );
957 // Sort appropriately
958 if( m_compoundsMorphemeCountSortFlag
->isChecked() ) m_pLexicon
->GetCompounds()->Sort(PARSE_SIZE
);
959 else if( m_compoundsCorpusCountSortFlag
->isChecked() ) m_pLexicon
->GetCompounds()->Sort(CORPUSCOUNT
);
960 else m_pLexicon
->GetCompounds()->Sort(KEY
);
962 // Output text file stuff
964 for( i
= 0; i
< m_pLexicon
->GetCompounds()->GetCount(); i
++ )
966 pCompound
= m_pLexicon
->GetCompounds()->GetAtSort(i
);
968 if( m_compoundsColumnTitlesFlag
->isChecked() ) *out
<< " ";
970 line
= m_compoundsLine
->text();
972 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
974 while( line
.length() > 0 )
976 start
= line
.find( "%" );
984 *out
<< line
.left( start
);
985 line
= line
.mid( start
);
986 end
= line
.find( "%", 1 );
987 field
= line
.mid( 0, end
+ 1 );
989 if( field
== INDEX_FIELD
)
992 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
995 if( field
== COMPOUND_FIELD
)
998 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[COMPOUND_FIELD
] );
999 *out
<< pCompound
->Display( filter
);
1001 if( field
== CORPUS_COUNT_FIELD
)
1004 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
1005 *out
<< pCompound
->GetCorpusCount();
1007 if( field
== MORPHS_COUNT_FIELD
)
1010 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_COUNT_FIELD
] );
1011 *out
<< pCompound
->Size();
1013 if( field
== MORPHS_FIELD
)
1016 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MORPHS_FIELD
] );
1017 *out
<< getCompoundMorphsField( pCompound
);
1019 if( field
== SUFFIXNESS_FIELD
)
1022 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIXNESS_FIELD
] );
1023 *out
<< pCompound
->GetSuffixness();
1025 if( field
== PREFIXNESS_FIELD
)
1028 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIXNESS_FIELD
] );
1029 *out
<< pCompound
->GetPrefixness();
1031 if( field
== PARSE_FIELD
)
1034 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PARSE_FIELD
] );
1035 *out
<< pCompound
->DisplayBestParse( filter
);
1038 line
= line
.mid( end
+ 1 );
1045 delete file
; file
= NULL
;
1046 delete out
; out
= NULL
;
1050 // Write mark-up file
1051 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
1053 file
= new QFile( fileName
+ ".html" );
1054 if( file
->open( QIODevice::WriteOnly
) )
1056 out
= new Q3TextStream( file
);
1057 out
->setEncoding( Q3TextStream::Unicode
);
1059 // Output html file stuff
1060 *out
<< getHTMLHeader( m_projectName
->text(), COMPOUNDS_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
1062 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
1065 if( m_compoundsColumnTitlesFlag
->isChecked() )
1067 *out
<< "\t\t\t\t<tr>\n";
1069 line
= m_compoundsLine
->text();
1071 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1073 while( line
.length() > 0 )
1075 start
= line
.find( "%" );
1076 if( start
< 0 ) break;
1078 line
= line
.mid( start
);
1079 end
= line
.find( "%", 1 );
1080 field
= line
.mid( 0, end
+ 1 );
1082 if( field
== INDEX_FIELD
)
1084 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
1086 if( field
== COMPOUND_FIELD
)
1088 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << COMPOUND_FIELD_TITLE
<< "</span></td>\n";
1090 if( field
== CORPUS_COUNT_FIELD
)
1092 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
1094 if( field
== MORPHS_COUNT_FIELD
)
1096 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MORPHS_COUNT_FIELD_TITLE
<< "</span></td>\n";
1098 if( field
== MORPHS_FIELD
)
1100 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << MORPHS_FIELD_TITLE
<< "</span></td>\n";
1102 if( field
== SUFFIXNESS_FIELD
)
1104 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SUFFIXNESS_FIELD_TITLE
<< "</span></td>\n";
1106 if( field
== PREFIXNESS_FIELD
)
1108 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << PREFIXNESS_FIELD_TITLE
<< "</span></td>\n";
1110 if( field
== PARSE_FIELD
)
1112 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << PARSE_FIELD_TITLE
<< "</span></td>\n";
1115 line
= line
.mid( end
+ 1 );
1118 *out
<< "\t\t\t\t</tr>\n";
1122 // Sort appropriately
1123 if( m_compoundsMorphemeCountSortFlag
->isChecked() ) m_pLexicon
->GetCompounds()->Sort(PARSE_SIZE
);
1124 else if( m_compoundsCorpusCountSortFlag
->isChecked() ) m_pLexicon
->GetCompounds()->Sort(CORPUSCOUNT
);
1125 else m_pLexicon
->GetCompounds()->Sort(KEY
);
1127 QDir
dir( m_outputDirectory
->text() );
1128 dir
.cd( projectName
);
1129 if( m_compoundsLine
->text().contains( PARSE_FIELD
) ) dir
.mkdir( "images" );
1133 CanvasDialog
* canvasDlg
= new CanvasDialog( this,
1134 Qt::WStyle_Customize
|
1135 Qt::WStyle_NormalBorder
|
1137 Qt::WStyle_SysMenu
);
1139 // Output html file stuff
1141 for( i
= 0; i
< m_pLexicon
->GetCompounds()->GetCount(); i
++ )
1143 pCompound
= m_pLexicon
->GetCompounds()->GetAtSort(i
);
1145 if( m_compoundsLine
->text().contains( PARSE_FIELD
) )
1147 picName
= pCompound
->Display( filter
);
1149 // Remove Windows' illegal file characters
1150 picName
.remove( "\\" );
1151 picName
.remove( "/" );
1152 picName
.remove( ":" );
1153 picName
.remove( "*" );
1154 picName
.remove( "?" );
1155 picName
.remove( "\"" );
1156 picName
.remove( "<" );
1157 picName
.remove( ">" );
1158 picName
.remove( "|" );
1160 saveParseImage( pCompound
->GetParse( pCompound
->GetBestParse() ),
1161 "images/" + picName
+ ".png", canvasDlg
);
1164 *out
<< "\t\t\t\t<tr>\n";
1166 line
= m_compoundsLine
->text();
1168 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1170 while( line
.length() > 0 )
1172 start
= line
.find( "%" );
1173 if( start
< 0 ) break;
1175 line
= line
.mid( start
);
1176 end
= line
.find( "%", 1 );
1177 field
= line
.mid( 0, end
+ 1 );
1179 if( field
== INDEX_FIELD
)
1181 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << index
++ << "</td>\n";
1183 if( field
== COMPOUND_FIELD
)
1185 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"><a name=\"_" << pCompound
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pCompound
, TRUE
, TRUE
) << "</a></td>\n";
1187 if( field
== CORPUS_COUNT_FIELD
)
1189 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << QString( "%1" ).arg( pCompound
->GetCorpusCount() ) << "</td>\n";
1191 if( field
== MORPHS_COUNT_FIELD
)
1193 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << QString( "%1" ).arg( pCompound
->Size() ) << "</td>\n";
1195 if( field
== MORPHS_FIELD
)
1197 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getCompoundMorphsField( pCompound
, TRUE
) << "</td>\n";
1199 if( field
== SUFFIXNESS_FIELD
)
1201 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << QString( "%1" ).arg( pCompound
->GetSuffixness() ) << "</td>\n";
1203 if( field
== PREFIXNESS_FIELD
)
1205 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << QString( "%1" ).arg( pCompound
->GetPrefixness() ) << "</td>\n";
1207 if( field
== PARSE_FIELD
)
1209 picName
= pCompound
->Display( filter
);
1211 // Remove Windows' illegal file characters
1212 picName
.remove( "\\" );
1213 picName
.remove( "/" );
1214 picName
.remove( ":" );
1215 picName
.remove( "*" );
1216 picName
.remove( "?" );
1217 picName
.remove( "\"" );
1218 picName
.remove( "<" );
1219 picName
.remove( ">" );
1220 picName
.remove( "|" );
1222 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\"><img src=\"images/" << picName
<< ".png\" border=\"0\" /></td>\n";
1225 line
= line
.mid( end
+ 1 );
1228 *out
<< "\t\t\t\t</tr>\n";
1230 if( index
% 20 == 0 )
1232 *out
<< "\t\t\t\t<tr>\n";
1233 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_compoundsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
1234 *out
<< "\t\t\t\t</tr>\n";
1238 *out
<< "\t\t\t</table>\n";
1240 *out
<< getHTMLFooter();
1243 delete file
; file
= NULL
;
1244 delete out
; out
= NULL
;
1245 delete canvasDlg
; canvasDlg
= NULL
;
1251 void ExportWizard::exportLinkers()
1257 CCompound
* pCompound
;
1259 StringToString
* filter
= m_pLexicon
->GetOutFilter();
1261 QMap
<QString
,int> fieldWidths
;
1267 QString line
, field
, fileName
, url
, type
= "compound";
1269 fileName
= m_projectName
->text() + "_" + LINKERS_FILE_TITLE
;
1270 fileName
.replace( " ", "_" );
1272 url
= m_projectName
->text() + "_" + COMPOUNDS_FILE_TITLE
+ ".html";
1273 url
.replace( " ", "_" );
1275 // Write simple text file
1276 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
1278 file
= new QFile( fileName
+ ".txt" );
1279 if( file
->open( QIODevice::WriteOnly
) )
1281 fieldWidths
.clear();
1284 if( m_linkersUniformFieldWidthsFlag
->isChecked() )
1286 if( m_linkersColumnTitlesFlag
->isChecked() )
1288 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
1289 fieldWidths
[LINKER_FIELD
] = LINKER_FIELD_TITLE
.length();
1290 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
1291 fieldWidths
[COMPOUND_COUNT_FIELD
] = COMPOUND_COUNT_FIELD_TITLE
.length();
1292 if( m_linkersIncludeCompoundListFlag
->isChecked() ) fieldWidths
[COMPOUNDS_FIELD
] = 0;
1295 m_pLexicon
->GetLinkers()->Sort(PARSE_SIZE
);
1296 for( i
= 0; i
< m_pLexicon
->GetLinkers()->GetCount(); i
++ )
1298 pLinker
= m_pLexicon
->GetLinkers()->GetAtSort(i
);
1300 if( m_linkersLine
->text().find( INDEX_FIELD
) >= 0 )
1302 width
= QString( "%1" ).arg( i
+ 1 ).length();
1303 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
1305 if( m_linkersLine
->text().find( LINKER_FIELD
) >= 0 )
1307 width
= pLinker
->Display( filter
).length();
1308 if( width
> fieldWidths
[LINKER_FIELD
] ) fieldWidths
[LINKER_FIELD
] = width
;
1310 if( m_linkersLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
1312 width
= QString( "%1" ).arg( pLinker
->GetCorpusCount() ).length();
1313 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
1315 if( m_linkersLine
->text().find( COMPOUND_COUNT_FIELD
) >= 0 )
1317 width
= QString( "%1" ).arg( pLinker
->GetCompoundCount() ).length();
1318 if( width
> fieldWidths
[COMPOUND_COUNT_FIELD
] ) fieldWidths
[COMPOUND_COUNT_FIELD
] = width
;
1320 if( m_linkersIncludeCompoundListFlag
->isChecked() )
1323 for( j
= 0; j
< pLinker
->GetNumberOfCompounds(); j
++ )
1325 pCompound
= pLinker
->GetAtCompound(j
);
1327 if( width
< static_cast <int> (pCompound
->Display( filter
).length() ) ) width
= static_cast <int> (pCompound
->Display( filter
).length());
1329 if( width
> fieldWidths
[COMPOUNDS_FIELD
] ) fieldWidths
[COMPOUNDS_FIELD
] = width
;
1336 out
= new Q3TextStream( file
);
1337 out
->setEncoding( Q3TextStream::Unicode
);
1341 if( m_linkersColumnTitlesFlag
->isChecked() )
1345 line
= m_linkersLine
->text();
1347 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1349 while( line
.length() > 0 )
1351 start
= line
.find( "%" );
1359 *out
<< line
.left( start
);
1360 line
= line
.mid( start
);
1361 end
= line
.find( "%", 1 );
1362 field
= line
.mid( 0, end
+ 1 );
1364 if( field
== INDEX_FIELD
)
1367 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
1368 *out
<< INDEX_FIELD_TITLE
;
1370 if( field
== LINKER_FIELD
)
1373 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[LINKER_FIELD
] );
1374 *out
<< LINKER_FIELD_TITLE
;
1376 if( field
== CORPUS_COUNT_FIELD
)
1379 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
1380 *out
<< CORPUS_COUNT_FIELD_TITLE
;
1382 if( field
== COMPOUND_COUNT_FIELD
)
1385 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[COMPOUND_COUNT_FIELD
] );
1386 *out
<< COMPOUND_COUNT_FIELD_TITLE
;
1389 line
= line
.mid( end
+ 1 );
1395 // Sort appropriately
1396 if( m_linkersCorpusCountSortFlag
->isChecked() ) m_pLexicon
->GetLinkers()->Sort(CORPUSCOUNT
);
1397 else m_pLexicon
->GetLinkers()->Sort(KEY
);
1399 // Output text file stuff
1401 for( i
= 0; i
< m_pLexicon
->GetLinkers()->GetCount(); i
++ )
1403 pLinker
= m_pLexicon
->GetLinkers()->GetAtSort(i
);
1405 if( m_linkersColumnTitlesFlag
->isChecked() ) *out
<< " ";
1407 line
= m_linkersLine
->text();
1409 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1411 while( line
.length() > 0 )
1413 start
= line
.find( "%" );
1421 *out
<< line
.left( start
);
1422 line
= line
.mid( start
);
1423 end
= line
.find( "%", 1 );
1424 field
= line
.mid( 0, end
+ 1 );
1426 if( field
== INDEX_FIELD
)
1429 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
1432 if( field
== LINKER_FIELD
)
1435 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[LINKER_FIELD
] );
1436 *out
<< pLinker
->Display( filter
);
1438 if( field
== CORPUS_COUNT_FIELD
)
1441 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
1442 *out
<< pLinker
->GetCorpusCount();
1444 if( field
== COMPOUND_COUNT_FIELD
)
1447 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[COMPOUND_COUNT_FIELD
] );
1448 *out
<< pLinker
->GetCompoundCount();
1451 line
= line
.mid( end
+ 1 );
1456 if( m_linkersIncludeCompoundListFlag
->isChecked() )
1459 if( m_linkersColumnTitlesFlag
->isChecked() )
1461 *out
<< "# " << COMPOUNDS_FIELD_TITLE
<< endl
;
1462 *out
<< "# -------------------------------------------\n";
1465 for( j
= 0; j
< pLinker
->GetNumberOfCompounds(); j
++ )
1467 pCompound
= pLinker
->GetAtCompound(j
);
1469 if( count
% 5 == 0 )
1473 if( m_linkersColumnTitlesFlag
->isChecked() ) *out
<< " ";
1477 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
1478 *out
<< pCompound
->Display( filter
);
1487 delete file
; file
= NULL
;
1488 delete out
; out
= NULL
;
1492 // Write mark-up file
1493 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
1495 file
= new QFile( fileName
+ ".html" );
1496 if( file
->open( QIODevice::WriteOnly
) )
1498 out
= new Q3TextStream( file
);
1499 out
->setEncoding( Q3TextStream::Unicode
);
1501 // Output html file stuff
1502 *out
<< getHTMLHeader( m_projectName
->text(), LINKERS_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
1504 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
1507 if( m_linkersColumnTitlesFlag
->isChecked() )
1509 *out
<< "\t\t\t\t<tr>\n";
1511 line
= m_linkersLine
->text();
1513 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1515 while( line
.length() > 0 )
1517 start
= line
.find( "%" );
1519 if( start
< 0 ) break;
1521 line
= line
.mid( start
);
1522 end
= line
.find( "%", 1 );
1523 field
= line
.mid( 0, end
+ 1 );
1525 if( field
== INDEX_FIELD
)
1527 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
1529 if( field
== LINKER_FIELD
)
1531 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << LINKER_FIELD_TITLE
<< "</span></td>\n";
1533 if( field
== CORPUS_COUNT_FIELD
)
1535 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
1537 if( field
== COMPOUND_COUNT_FIELD
)
1539 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << COMPOUND_COUNT_FIELD_TITLE
<< "</span></td>\n";
1542 line
= line
.mid( end
+ 1 );
1545 *out
<< "\t\t\t\t</tr>\n";
1549 // Sort appropriately
1550 if( m_linkersCorpusCountSortFlag
->isChecked() ) m_pLexicon
->GetLinkers()->Sort(CORPUSCOUNT
);
1551 else m_pLexicon
->GetLinkers()->Sort(KEY
);
1554 // Output html file stuff
1556 for( i
= 0; i
< m_pLexicon
->GetLinkers()->GetCount(); i
++ )
1558 pLinker
= m_pLexicon
->GetLinkers()->GetAtSort(i
);
1560 *out
<< "\t\t\t\t<tr>\n";
1562 line
= m_linkersLine
->text();
1564 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1566 while( line
.length() > 0 )
1568 start
= line
.find( "%" );
1569 if( start
< 0 ) break;
1571 line
= line
.mid( start
);
1572 end
= line
.find( "%", 1 );
1573 field
= line
.mid( 0, end
+ 1 );
1575 if( field
== INDEX_FIELD
)
1577 *out
<< "\t\t\t\t\t<td";
1578 if( !m_linkersIncludeCompoundListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
1579 *out
<< ">" << index
++ << "</td>\n";
1581 if( field
== LINKER_FIELD
)
1583 *out
<< "\t\t\t\t\t<td";
1584 if( !m_linkersIncludeCompoundListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
1585 *out
<< ">" << "<a name=\"_" << pLinker
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pLinker
, TRUE
, TRUE
) << "</a></td>\n";
1587 if( field
== CORPUS_COUNT_FIELD
)
1589 *out
<< "\t\t\t\t\t<td";
1590 if( !m_linkersIncludeCompoundListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
1591 *out
<< " align=\"center\">" << pLinker
->GetCorpusCount() << "</td>\n";
1593 if( field
== COMPOUND_COUNT_FIELD
)
1595 *out
<< "\t\t\t\t\t<td";
1596 if( !m_linkersIncludeCompoundListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
1597 *out
<< " align=\"center\">" << pLinker
->GetCompoundCount() << "</td>\n";
1600 line
= line
.mid( end
+ 1 );
1603 *out
<< "\t\t\t\t</tr>\n";
1605 if( m_linkersIncludeCompoundListFlag
->isChecked() )
1607 *out
<< "\t\t\t\t<tr>\n";
1608 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_linkersLine
->text().count( "%" ) / 2 ) << "\">\n";
1609 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << COMPOUNDS_FIELD_TITLE
<< "</span><br>\n";
1610 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
1613 *out
<< "\t\t\t\t\t\t\t<tr>\n";
1614 for( j
= 0; j
< pLinker
->GetNumberOfCompounds(); j
++ )
1616 pCompound
= pLinker
->GetAtCompound(j
);
1618 if( count
> 0 && count
% 5 == 0 )
1620 *out
<< "\t\t\t\t\t\t\t</tr>\n";
1621 *out
<< "\t\t\t\t\t\t\t<tr>\n";
1624 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pCompound
, TRUE
, FALSE
) << "</td>\n";
1627 while( count
> 5 && count
% 5 != 0 )
1629 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
1633 *out
<< "\t\t\t\t\t\t\t</tr>\n";
1635 *out
<< "\t\t\t\t\t\t</table><br>\n";
1636 *out
<< "\t\t\t\t\t</td>\n";
1637 *out
<< "\t\t\t\t</tr>\n";
1640 if( index
% 20 == 0 )
1642 *out
<< "\t\t\t\t<tr>\n";
1643 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_linkersLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
1644 *out
<< "\t\t\t\t</tr>\n";
1648 *out
<< "\t\t\t</table>\n";
1650 *out
<< getHTMLFooter();
1653 delete file
; file
= NULL
;
1654 delete out
; out
= NULL
;
1660 void ExportWizard::exportAllWords()
1669 StringToString
* filter
= m_pLexicon
->GetOutFilter();
1671 QMap
<QString
,int> fieldWidths
;
1672 int width
, start
, end
, index
;
1674 QString line
, field
,
1675 fileName
= m_projectName
->text() + "_" + ALL_WORDS_FILE_TITLE
;
1677 QStringList alphabetized
;
1679 fileName
.replace( " ", "_" );
1681 Q3DictIterator
<StemSet
> it( *m_pLexicon
->GetAllWords() );
1683 // Get all words for alphabetization
1684 for( ; it
.current(); ++it
)
1686 alphabetized
.append( it
.currentKey() );
1689 // Write simple text file
1690 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
1692 file
= new QFile( fileName
+ ".txt" );
1693 if( file
->open( QIODevice::WriteOnly
) )
1695 fieldWidths
.clear();
1698 if( m_allWordsUniformFieldWidthsFlag
->isChecked() )
1700 if( m_allWordsColumnTitlesFlag
->isChecked() )
1702 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
1703 fieldWidths
[WORD_FIELD
] = WORD_FIELD_TITLE
.length();
1704 fieldWidths
[MINI_LEX_FIELD
] = MINI_LEX_FIELD_TITLE
.length();
1705 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
1706 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
1707 fieldWidths
[TYPE_FIELD
] = TYPE_FIELD_TITLE
.length();
1708 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
1709 fieldWidths
[SOURCE_FIELD
] = SOURCE_FIELD_TITLE
.length();
1710 fieldWidths
[PREFIX_FIELD
] = PREFIX_FIELD_TITLE
.length();
1711 fieldWidths
[STEM_FIELD
] = STEM_FIELD_TITLE
.length();
1712 fieldWidths
[SUFFIX_FIELD
] = SUFFIX_FIELD_TITLE
.length();
1717 for( ; it
.current(); ++it
)
1719 pWords
= it
.current();
1721 //for( pWord = pWords->first(); pWord; pWord = pWords->next() )
1722 for (int z
= 0; z
< pWords
->size(); z
++)
1724 CStem
* pWord
= pWords
->at(z
);
1725 if( m_allWordsAnalyzedOnlyFlag
->isChecked() && pWord
->Size() < 2 ) continue;
1729 if( pWord
->Size() > 1 )
1731 pSig
= pWord
->GetSuffixSignature();
1732 if( pSig
== NULL
) pSig
= pWord
->GetPrefixSignature();
1736 if( m_allWordsLine
->text().find( INDEX_FIELD
) >= 0 )
1738 width
= QString( "%1" ).arg( index
).length();
1739 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
1741 if( m_allWordsLine
->text().find( WORD_FIELD
) >= 0 )
1743 width
= pWord
->Display( filter
).length();
1744 if( width
> fieldWidths
[WORD_FIELD
] ) fieldWidths
[WORD_FIELD
] = width
;
1746 if( m_allWordsLine
->text().find( MINI_LEX_FIELD
) >= 0 )
1748 width
= QString( "%1" ).arg( pWord
->GetMyMini()->GetIndex() + 1 + 1 ).length();
1749 if( width
> fieldWidths
[MINI_LEX_FIELD
] ) fieldWidths
[MINI_LEX_FIELD
] = width
;
1751 if( m_allWordsLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
1753 width
= QString( "%1" ).arg( pWord
->CalculateDL() ).length();
1754 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
1756 if( m_allWordsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
1758 width
= QString( "%1" ).arg( pWord
->GetCorpusCount() ).length();
1759 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
1761 if( m_allWordsLine
->text().find( TYPE_FIELD
) >= 0 )
1763 width
= pWord
->DisplayStemType().length();
1764 if( width
> fieldWidths
[TYPE_FIELD
] ) fieldWidths
[TYPE_FIELD
] = width
;
1766 if( m_allWordsLine
->text().find( SIGNATURE_FIELD
) >= 0 )
1768 if( pSig
) width
= pSig
->Display( '.', filter
).length();
1770 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
1772 if( m_allWordsLine
->text().find( SOURCE_FIELD
) >= 0 )
1774 if( pSig
) width
= pSig
->GetRemark().length();
1775 else width
= pWord
->GetConfidence().length();
1776 if( width
> fieldWidths
[SOURCE_FIELD
] ) fieldWidths
[SOURCE_FIELD
] = width
;
1778 if( m_allWordsLine
->text().find( PREFIX_FIELD
) >= 0 )
1780 width
= pWord
->GetPiece( pWord
->GetPrefixLoc() ).Display( filter
).length();
1781 if( width
> fieldWidths
[PREFIX_FIELD
] ) fieldWidths
[PREFIX_FIELD
] = width
;
1783 if( m_allWordsLine
->text().find( STEM_FIELD
) >= 0 )
1785 width
= pWord
->GetStem().Display( filter
).length();
1786 if( width
> fieldWidths
[STEM_FIELD
] ) fieldWidths
[STEM_FIELD
] = width
;
1788 if( m_allWordsLine
->text().find( SUFFIX_FIELD
) >= 0 )
1790 width
= pWord
->GetPiece( pWord
->GetSuffixLoc() ).Display( filter
).length();
1791 if( width
> fieldWidths
[SUFFIX_FIELD
] ) fieldWidths
[SUFFIX_FIELD
] = width
;
1799 out
= new Q3TextStream( file
);
1800 out
->setEncoding( Q3TextStream::Unicode
);
1804 if( m_allWordsColumnTitlesFlag
->isChecked() )
1808 line
= m_allWordsLine
->text();
1810 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1812 while( line
.length() > 0 )
1814 start
= line
.find( "%" );
1822 *out
<< line
.left( start
);
1823 line
= line
.mid( start
);
1824 end
= line
.find( "%", 1 );
1825 field
= line
.mid( 0, end
+ 1 );
1827 if( field
== INDEX_FIELD
)
1830 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
1831 *out
<< INDEX_FIELD_TITLE
;
1833 if( field
== WORD_FIELD
)
1836 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[WORD_FIELD
] );
1837 *out
<< WORD_FIELD_TITLE
;
1839 if( field
== CORPUS_COUNT_FIELD
)
1842 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
1843 *out
<< CORPUS_COUNT_FIELD_TITLE
;
1845 if( field
== MINI_LEX_FIELD
)
1848 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
1849 *out
<< MINI_LEX_FIELD_TITLE
;
1851 if( field
== DESC_LENGTH_FIELD
)
1854 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
1855 *out
<< DESC_LENGTH_FIELD_TITLE
;
1857 if( field
== TYPE_FIELD
)
1860 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
1861 *out
<< TYPE_FIELD_TITLE
;
1863 if( field
== SIGNATURE_FIELD
)
1866 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
1867 *out
<< SIGNATURE_FIELD_TITLE
;
1869 if( field
== SOURCE_FIELD
)
1872 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SOURCE_FIELD
] );
1873 *out
<< SOURCE_FIELD_TITLE
;
1875 if( field
== PREFIX_FIELD
)
1878 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
1879 *out
<< PREFIX_FIELD_TITLE
;
1881 if( field
== STEM_FIELD
)
1884 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
1885 *out
<< STEM_FIELD_TITLE
;
1887 if( field
== SUFFIX_FIELD
)
1890 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
1891 *out
<< SUFFIX_FIELD_TITLE
;
1894 line
= line
.mid( end
+ 1 );
1901 alphabetized
.sort();
1903 // Output text file stuff
1905 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
1907 pWords
= ( *m_pLexicon
->GetAllWords() )[ *sIt
];
1909 for (int z
= 0; z
< pWords
->size(); z
++)
1911 CStem
* pWord
= pWords
->at(z
);
1912 if( m_allWordsAnalyzedOnlyFlag
->isChecked() && pWord
->Size() < 2 ) continue;
1916 if( m_allWordsColumnTitlesFlag
->isChecked() ) *out
<< " ";
1918 line
= m_allWordsLine
->text();
1920 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
1922 if( pWord
->Size() > 1 )
1924 pSig
= pWord
->GetSuffixSignature();
1925 if( pSig
== NULL
) pSig
= pWord
->GetPrefixSignature();
1929 while( line
.length() > 0 )
1931 start
= line
.find( "%" );
1939 *out
<< line
.left( start
);
1940 line
= line
.mid( start
);
1941 end
= line
.find( "%", 1 );
1942 field
= line
.mid( 0, end
+ 1 );
1944 if( field
== INDEX_FIELD
)
1947 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
1950 if( field
== WORD_FIELD
)
1953 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[WORD_FIELD
] );
1954 *out
<< pWord
->Display( filter
);
1956 if( field
== CORPUS_COUNT_FIELD
)
1959 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
1960 *out
<< pWord
->GetCorpusCount();
1962 if( field
== MINI_LEX_FIELD
)
1965 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
1966 *out
<< pWord
->GetMyMini()->GetIndex() + 1 + 1;
1968 if( field
== DESC_LENGTH_FIELD
)
1971 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
1972 *out
<< pWord
->CalculateDL();
1974 if( field
== TYPE_FIELD
)
1977 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
1978 *out
<< pWord
->DisplayStemType();
1980 if( field
== SIGNATURE_FIELD
)
1983 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
1984 if( pSig
) *out
<< getLParseText( pSig
);
1987 if( field
== SOURCE_FIELD
)
1990 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SOURCE_FIELD
] );
1991 if( pSig
) *out
<< pSig
->GetRemark();
1992 else *out
<< pWord
->GetConfidence();
1994 if( field
== PREFIX_FIELD
)
1997 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
1998 *out
<< pWord
->GetPiece( pWord
->GetPrefixLoc() ).Display( filter
);
2000 if( field
== STEM_FIELD
)
2003 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
2004 *out
<< pWord
->GetStem().Display( filter
);
2006 if( field
== SUFFIX_FIELD
)
2009 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
2010 *out
<< pWord
->GetPiece( pWord
->GetSuffixLoc() ).Display( filter
);
2013 line
= line
.mid( end
+ 1 );
2021 delete file
; file
= NULL
;
2022 delete out
; out
= NULL
;
2026 // Write mark-up file
2027 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
2031 bool do_not_link_words
= !m_miniWordsFlag
->isChecked() || m_miniWordsAnalyzedOnlyFlag
->isChecked();
2033 file
= new QFile( fileName
+ ".html" );
2034 if( file
->open( QIODevice::WriteOnly
) )
2036 out
= new Q3TextStream( file
);
2037 out
->setEncoding( Q3TextStream::Unicode
);
2039 // Output html file stuff
2040 *out
<< getHTMLHeader( m_projectName
->text(), ALL_WORDS_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
2042 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
2045 if( m_allWordsColumnTitlesFlag
->isChecked() )
2047 *out
<< "\t\t\t\t<tr>\n";
2049 line
= m_allWordsLine
->text();
2051 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2053 while( line
.length() > 0 )
2055 start
= line
.find( "%" );
2056 if( start
< 0 ) break;
2058 line
= line
.mid( start
);
2059 end
= line
.find( "%", 1 );
2060 field
= line
.mid( 0, end
+ 1 );
2062 if( field
== INDEX_FIELD
)
2064 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
2066 if( field
== WORD_FIELD
)
2068 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << WORD_FIELD_TITLE
<< "</span></td>\n";
2070 if( field
== CORPUS_COUNT_FIELD
)
2072 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
2074 if( field
== MINI_LEX_FIELD
)
2076 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MINI_LEX_FIELD_TITLE
<< "</span></td>\n";
2078 if( field
== DESC_LENGTH_FIELD
)
2080 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
2082 if( field
== TYPE_FIELD
)
2084 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << TYPE_FIELD_TITLE
<< "</span></td>\n";
2086 if( field
== SIGNATURE_FIELD
)
2088 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
2090 if( field
== SOURCE_FIELD
)
2092 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SOURCE_FIELD_TITLE
<< "</span></td>\n";
2094 if( field
== PREFIX_FIELD
)
2096 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << PREFIX_FIELD_TITLE
<< "</span></td>\n";
2098 if( field
== STEM_FIELD
)
2100 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << STEM_FIELD_TITLE
<< "</span></td>\n";
2102 if( field
== SUFFIX_FIELD
)
2104 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SUFFIX_FIELD_TITLE
<< "</span></td>\n";
2107 line
= line
.mid( end
+ 1 );
2110 *out
<< "\t\t\t\t</tr>\n";
2114 alphabetized
.sort();
2116 // Output html file stuff
2118 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
2120 pWords
= ( *m_pLexicon
->GetAllWords() )[ *sIt
];
2121 for (int y
= 0; y
< pWords
->size(); y
++)
2123 CStem
* pWord
= pWords
->at(y
);
2124 if( m_allWordsAnalyzedOnlyFlag
->isChecked() && pWord
->Size() < 2 ) continue;
2126 *out
<< "\t\t\t\t<tr>\n";
2130 line
= m_allWordsLine
->text();
2132 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2134 if( pWord
->Size() > 1 )
2136 pSig
= pWord
->GetSuffixSignature();
2137 if( pSig
== NULL
) pSig
= pWord
->GetPrefixSignature();
2141 while( line
.length() > 0 )
2143 start
= line
.find( "%" );
2144 if( start
< 0 ) break;
2146 line
= line
.mid( start
);
2147 end
= line
.find( "%", 1 );
2148 field
= line
.mid( 0, end
+ 1 );
2150 if( field
== INDEX_FIELD
)
2152 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << index
<< "</td>\n";
2154 if( field
== WORD_FIELD
)
2156 bool do_not_link_word
= do_not_link_words
&& pWord
->Size() < 2;
2157 url
= m_projectName
->text() + QString( "_Mini_%1_Words.html" ).arg( pWord
->GetMyMini()->GetIndex() + 1 );
2158 url
.replace( " ", "_" );
2159 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
, TRUE
, do_not_link_word
, "word", url
) << "</td>\n";
2161 if( field
== CORPUS_COUNT_FIELD
)
2163 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << pWord
->GetCorpusCount() << "</td>\n";
2165 if( field
== MINI_LEX_FIELD
)
2167 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << pWord
->GetMyMini()->GetIndex() + 1 << "</td>\n";
2169 if( field
== DESC_LENGTH_FIELD
)
2171 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pWord
->CalculateDL() << "</td>\n";
2173 if( field
== TYPE_FIELD
)
2175 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pWord
->DisplayStemType() << "</td>\n";
2177 if( field
== SIGNATURE_FIELD
)
2179 if( pSig
) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pSig
, TRUE
) << "</td>\n";
2180 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
2182 if( field
== SOURCE_FIELD
)
2184 if( pSig
) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pSig
->GetRemark() << "</td>\n";
2185 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pWord
->GetConfidence() << "</td>\n";
2187 if( field
== PREFIX_FIELD
)
2189 if( pWord
->GetPrefixPtr() ) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
->GetPrefixPtr(), TRUE
) << "</td>\n";
2190 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
2192 if( field
== STEM_FIELD
)
2194 if( pWord
->GetStemPtr() ) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
->GetStemPtr(), TRUE
) << "</td>\n";
2195 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
2197 if( field
== SUFFIX_FIELD
)
2199 if( pWord
->GetSuffixPtr() ) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
->GetSuffixPtr(), TRUE
) << "</td>\n";
2200 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
2203 line
= line
.mid( end
+ 1 );
2206 *out
<< "\t\t\t\t</tr>\n";
2208 if( index
% 20 == 0 )
2210 *out
<< "\t\t\t\t<tr>\n";
2211 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_allWordsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
2212 *out
<< "\t\t\t\t</tr>\n";
2217 *out
<< "\t\t\t</table>\n";
2219 *out
<< getHTMLFooter();
2222 delete file
; file
= NULL
;
2223 delete out
; out
= NULL
;
2229 void ExportWizard::exportAllStems()
2239 StringToString
* filter
= m_pLexicon
->GetOutFilter();
2241 QMap
<QString
,int> fieldWidths
;
2242 int width
, start
, end
, index
;
2244 QString line
, field
,
2245 fileName
= m_projectName
->text() + "_" + ALL_STEMS_FILE_TITLE
;
2247 QStringList alphabetized
;
2249 fileName
.replace( " ", "_" );
2251 Q3DictIterator
<StemSet
> it( *m_pLexicon
->GetAllStems() );
2253 // Get all words for alphabetization
2254 for( ; it
.current(); ++it
)
2256 alphabetized
.append( it
.currentKey() );
2259 // Write simple text file
2260 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
2262 file
= new QFile( fileName
+ ".txt" );
2263 if( file
->open( QIODevice::WriteOnly
) )
2265 fieldWidths
.clear();
2268 if( m_allStemsUniformFieldWidthsFlag
->isChecked() )
2270 if( m_allStemsColumnTitlesFlag
->isChecked() )
2272 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
2273 fieldWidths
[STEM_FIELD
] = STEM_FIELD_TITLE
.length();
2274 fieldWidths
[MINI_LEX_FIELD
] = MINI_LEX_FIELD_TITLE
.length();
2275 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
2276 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
2277 fieldWidths
[TYPE_FIELD
] = TYPE_FIELD_TITLE
.length();
2278 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
2279 fieldWidths
[ORIGIN_FIELD
] = ORIGIN_FIELD_TITLE
.length();
2284 for( ; it
.current(); ++it
)
2286 pStems
= it
.current();
2288 for (int z
= 0; z
< pStems
->size(); z
++)
2289 { pStem
= pStems
->at(z
);
2292 pSig
= pStem
->GetSuffixSignature();
2293 if( !pSig
) pSig
= pStem
->GetPrefixSignature();
2295 if( m_allStemsLine
->text().find( INDEX_FIELD
) >= 0 )
2297 width
= QString( "%1" ).arg( index
).length();
2298 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
2300 if( m_allStemsLine
->text().find( STEM_FIELD
) >= 0 )
2302 width
= pStem
->Display( filter
).length();
2303 if( width
> fieldWidths
[STEM_FIELD
] ) fieldWidths
[STEM_FIELD
] = width
;
2305 if( m_allStemsLine
->text().find( MINI_LEX_FIELD
) >= 0 )
2307 width
= QString( "%1" ).arg( pStem
->GetMyMini()->GetIndex() + 1 ).length();
2308 if( width
> fieldWidths
[MINI_LEX_FIELD
] ) fieldWidths
[MINI_LEX_FIELD
] = width
;
2310 if( m_allStemsLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
2312 width
= QString( "%1" ).arg( pStem
->CalculateDL() ).length();
2313 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
2315 if( m_allStemsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
2317 width
= QString( "%1" ).arg( pStem
->GetCorpusCount() ).length();
2318 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
2320 if( m_allStemsLine
->text().find( TYPE_FIELD
) >= 0 )
2322 width
= pStem
->DisplayStemType().length();
2323 if( width
> fieldWidths
[TYPE_FIELD
] ) fieldWidths
[TYPE_FIELD
] = width
;
2325 if( m_allStemsLine
->text().find( SIGNATURE_FIELD
) >= 0 )
2327 if( pSig
) width
= pSig
->Display( '.', filter
).length();
2329 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
2331 if( m_allStemsLine
->text().find( ORIGIN_FIELD
) >= 0 )
2333 width
= pStem
->GetConfidence().length();
2334 if( width
> fieldWidths
[ORIGIN_FIELD
] ) fieldWidths
[ORIGIN_FIELD
] = width
;
2342 out
= new Q3TextStream( file
);
2343 out
->setEncoding( Q3TextStream::Unicode
);
2347 if( m_allStemsColumnTitlesFlag
->isChecked() )
2351 line
= m_allStemsLine
->text();
2353 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2355 while( line
.length() > 0 )
2357 start
= line
.find( "%" );
2365 *out
<< line
.left( start
);
2366 line
= line
.mid( start
);
2367 end
= line
.find( "%", 1 );
2368 field
= line
.mid( 0, end
+ 1 );
2370 if( field
== INDEX_FIELD
)
2373 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
2374 *out
<< INDEX_FIELD_TITLE
;
2376 if( field
== STEM_FIELD
)
2379 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
2380 *out
<< STEM_FIELD_TITLE
;
2382 if( field
== CORPUS_COUNT_FIELD
)
2385 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
2386 *out
<< CORPUS_COUNT_FIELD_TITLE
;
2388 if( field
== MINI_LEX_FIELD
)
2391 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
2392 *out
<< MINI_LEX_FIELD_TITLE
;
2394 if( field
== DESC_LENGTH_FIELD
)
2397 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
2398 *out
<< DESC_LENGTH_FIELD_TITLE
;
2400 if( field
== TYPE_FIELD
)
2403 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
2404 *out
<< TYPE_FIELD_TITLE
;
2406 if( field
== SIGNATURE_FIELD
)
2409 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
2410 *out
<< SIGNATURE_FIELD_TITLE
;
2412 if( field
== ORIGIN_FIELD
)
2415 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ORIGIN_FIELD
] );
2416 *out
<< ORIGIN_FIELD_TITLE
;
2419 line
= line
.mid( end
+ 1 );
2426 alphabetized
.sort();
2428 // Output text file stuff
2430 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
2432 pStems
= ( *m_pLexicon
->GetAllStems() )[ *sIt
];
2434 for (int y
= 0; y
< pStems
->size(); y
++)
2435 { pStem
= pStems
->at(y
);
2438 pSig
= pStem
->GetSuffixSignature();
2439 if( !pSig
) pSig
= pStem
->GetPrefixSignature();
2441 if( m_allStemsColumnTitlesFlag
->isChecked() ) *out
<< " ";
2443 line
= m_allStemsLine
->text();
2445 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2447 while( line
.length() > 0 )
2449 start
= line
.find( "%" );
2457 *out
<< line
.left( start
);
2458 line
= line
.mid( start
);
2459 end
= line
.find( "%", 1 );
2460 field
= line
.mid( 0, end
+ 1 );
2462 if( field
== INDEX_FIELD
)
2465 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
2468 if( field
== STEM_FIELD
)
2471 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
2472 *out
<< pStem
->Display( filter
);
2474 if( field
== CORPUS_COUNT_FIELD
)
2477 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
2478 *out
<< pStem
->GetCorpusCount();
2480 if( field
== MINI_LEX_FIELD
)
2483 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
2484 *out
<< pStem
->GetMyMini()->GetIndex() + 1;
2486 if( field
== DESC_LENGTH_FIELD
)
2489 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
2490 *out
<< pStem
->CalculateDL();
2492 if( field
== TYPE_FIELD
)
2495 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
2496 *out
<< pStem
->DisplayStemType();
2498 if( field
== ORIGIN_FIELD
)
2501 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ORIGIN_FIELD
] );
2502 *out
<< pStem
->GetConfidence();
2504 if( field
== SIGNATURE_FIELD
)
2507 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
2508 if( pSig
) *out
<< pSig
->Display( '.', filter
);
2512 line
= line
.mid( end
+ 1 );
2520 delete file
; file
= NULL
;
2521 delete out
; out
= NULL
;
2525 // Write mark-up file
2526 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
2530 file
= new QFile( fileName
+ ".html" );
2531 if( file
->open( QIODevice::WriteOnly
) )
2533 out
= new Q3TextStream( file
);
2534 out
->setEncoding( Q3TextStream::Unicode
);
2536 // Output html file stuff
2537 *out
<< getHTMLHeader( m_projectName
->text(), ALL_STEMS_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
2539 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
2542 if( m_allStemsColumnTitlesFlag
->isChecked() )
2544 *out
<< "\t\t\t\t<tr>\n";
2546 line
= m_allStemsLine
->text();
2548 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2550 while( line
.length() > 0 )
2552 start
= line
.find( "%" );
2553 if( start
< 0 ) break;
2555 line
= line
.mid( start
);
2556 end
= line
.find( "%", 1 );
2557 field
= line
.mid( 0, end
+ 1 );
2559 if( field
== INDEX_FIELD
)
2561 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
2563 if( field
== STEM_FIELD
)
2565 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << STEM_FIELD_TITLE
<< "</span></td>\n";
2567 if( field
== CORPUS_COUNT_FIELD
)
2569 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
2571 if( field
== MINI_LEX_FIELD
)
2573 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MINI_LEX_FIELD_TITLE
<< "</span></td>\n";
2575 if( field
== DESC_LENGTH_FIELD
)
2577 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
2579 if( field
== TYPE_FIELD
)
2581 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << TYPE_FIELD_TITLE
<< "</span></td>\n";
2583 if( field
== ORIGIN_FIELD
)
2585 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << ORIGIN_FIELD_TITLE
<< "</span></td>\n";
2587 if( field
== SIGNATURE_FIELD
)
2589 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
2592 line
= line
.mid( end
+ 1 );
2595 *out
<< "\t\t\t\t</tr>\n";
2599 alphabetized
.sort();
2601 // Output html file stuff
2603 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
2605 pStems
= ( *m_pLexicon
->GetAllStems() )[ *sIt
];
2607 for (int z
= 0; z
< pStems
->size(); z
++)
2608 { pStem
= pStems
->at(z
);
2609 *out
<< "\t\t\t\t<tr>\n";
2613 pSig
= pStem
->GetSuffixSignature();
2614 if( !pSig
) pSig
= pStem
->GetPrefixSignature();
2616 line
= m_allStemsLine
->text();
2618 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2620 while( line
.length() > 0 )
2622 start
= line
.find( "%" );
2623 if( start
< 0 ) break;
2625 line
= line
.mid( start
);
2626 end
= line
.find( "%", 1 );
2627 field
= line
.mid( 0, end
+ 1 );
2629 if( field
== INDEX_FIELD
)
2631 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << index
<< "</td>\n";
2633 if( field
== STEM_FIELD
)
2635 url
= m_projectName
->text() + QString( "_Mini_%1_Stems.html" ).arg( pStem
->GetMyMini()->GetIndex() + 1 );
2636 url
.replace( " ", "_" );
2637 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"><a name=\"_" + pStem
->Display() + "_\">" << getLParseText( pStem
, TRUE
, FALSE
, "stem", url
) << "</a></td>\n";
2639 if( field
== CORPUS_COUNT_FIELD
)
2641 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << pStem
->GetCorpusCount() << "</td>\n";
2643 if( field
== MINI_LEX_FIELD
)
2645 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << pStem
->GetMyMini()->GetIndex() + 1 << "</td>\n";
2647 if( field
== DESC_LENGTH_FIELD
)
2649 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pStem
->CalculateDL() << "</td>\n";
2651 if( field
== TYPE_FIELD
)
2653 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pStem
->DisplayStemType() << "</td>\n";
2655 if( field
== ORIGIN_FIELD
)
2657 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pStem
->GetConfidence() << "</td>\n";
2659 if( field
== SIGNATURE_FIELD
)
2661 if( pSig
) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pSig
, TRUE
) << "</td>\n";
2662 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
2665 line
= line
.mid( end
+ 1 );
2668 *out
<< "\t\t\t\t</tr>\n";
2670 if( index
% 20 == 0 )
2672 *out
<< "\t\t\t\t<tr>\n";
2673 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_allStemsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
2674 *out
<< "\t\t\t\t</tr>\n";
2679 *out
<< "\t\t\t</table>\n";
2681 *out
<< getHTMLFooter();
2684 delete file
; file
= NULL
;
2685 delete out
; out
= NULL
;
2691 void ExportWizard::exportAllSuffixSigs()
2696 SignatureSet
* pSigs
;
2701 StringToString
* filter
= m_pLexicon
->GetOutFilter();
2703 QMap
<QString
,int> fieldWidths
;
2704 int width
, count
, start
, end
, index
;
2706 QString line
, field
,
2707 fileName
= m_projectName
->text() + "_" + ALL_SUFFIX_SIGNATURES_FILE_TITLE
;
2709 QStringList alphabetized
;
2711 fileName
.replace( " ", "_" );
2713 Q3DictIterator
<SignatureSet
> it( *m_pLexicon
->GetAllSuffixSigs() );
2715 // Get all words for alphabetization
2716 for( ; it
.current(); ++it
)
2718 alphabetized
.append( it
.currentKey() );
2721 // Write simple text file
2722 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
2724 file
= new QFile( fileName
+ ".txt" );
2725 if( file
->open( QIODevice::WriteOnly
) )
2727 fieldWidths
.clear();
2730 if( m_allSuffixSigsUniformFieldWidthsFlag
->isChecked() )
2732 if( m_allSuffixSigsColumnTitlesFlag
->isChecked() )
2734 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
2735 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
2736 fieldWidths
[MINI_LEX_FIELD
] = MINI_LEX_FIELD_TITLE
.length();
2737 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
2738 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
2739 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
2740 fieldWidths
[EXEMPLAR_FIELD
] = EXEMPLAR_FIELD_TITLE
.length();
2741 fieldWidths
[REMARKS_FIELD
] = REMARKS_FIELD_TITLE
.length();
2742 fieldWidths
[ROBUSTNESS_FIELD
] = ROBUSTNESS_FIELD_TITLE
.length();
2743 if( m_allSuffixSigsIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
2748 for( ; it
.current(); ++it
)
2750 pSigs
= it
.current();
2752 for (int z
= 0; z
< pSigs
->size(); z
++)
2753 { pSig
= pSigs
->at(z
);
2756 if( m_allSuffixSigsLine
->text().find( INDEX_FIELD
) >= 0 )
2758 width
= QString( "%1" ).arg( index
).length();
2759 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
2761 if( m_allSuffixSigsLine
->text().find( SIGNATURE_FIELD
) >= 0 )
2763 width
= pSig
->Display( '.', filter
).length();
2764 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
2766 if( m_allSuffixSigsLine
->text().find( MINI_LEX_FIELD
) >= 0 )
2768 width
= QString( "%1" ).arg( pSig
->GetMyMini()->GetIndex() + 1 ).length();
2769 if( width
> fieldWidths
[MINI_LEX_FIELD
] ) fieldWidths
[MINI_LEX_FIELD
] = width
;
2771 if( m_allSuffixSigsLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
2773 width
= QString( "%1" ).arg( pSig
->ComputeDLofModel() ).length();
2774 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
2776 if( m_allSuffixSigsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
2778 width
= QString( "%1" ).arg( pSig
->GetCorpusCount() ).length();
2779 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
2781 if( m_allSuffixSigsLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
2783 width
= QString( "%1" ).arg( pSig
->GetNumberOfStems() ).length();
2784 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
2786 if( m_allSuffixSigsLine
->text().find( EXEMPLAR_FIELD
) >= 0 )
2788 width
= pSig
->GetStem(0)->Display( filter
).length();
2789 if( width
> fieldWidths
[EXEMPLAR_FIELD
] ) fieldWidths
[EXEMPLAR_FIELD
] = width
;
2791 if( m_allSuffixSigsLine
->text().find( REMARKS_FIELD
) >= 0 )
2793 width
= pSig
->GetRemark().length();
2794 if( width
> fieldWidths
[REMARKS_FIELD
] ) fieldWidths
[REMARKS_FIELD
] = width
;
2796 if( m_allSuffixSigsLine
->text().find( ROBUSTNESS_FIELD
) >= 0 )
2798 width
= QString( "%1" ).arg( pSig
->GetRobustness() ).length();
2799 if( width
> fieldWidths
[ROBUSTNESS_FIELD
] ) fieldWidths
[ROBUSTNESS_FIELD
] = width
;
2802 if( m_allSuffixSigsIncludeStemListFlag
->isChecked() )
2805 for (int stemno
= 0; stemno
< pSig
->GetNumberOfStems(); stemno
++)
2806 { pStem
= pSig
->GetStem(stemno
);
2807 if( width
< static_cast <int> (pStem
->Display( filter
).length()) ) width
= static_cast <int> (pStem
->Display( filter
).length());
2809 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
2816 out
= new Q3TextStream( file
);
2817 out
->setEncoding( Q3TextStream::Unicode
);
2821 if( m_allSuffixSigsColumnTitlesFlag
->isChecked() )
2825 line
= m_allSuffixSigsLine
->text();
2827 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2829 while( line
.length() > 0 )
2831 start
= line
.find( "%" );
2839 *out
<< line
.left( start
);
2840 line
= line
.mid( start
);
2841 end
= line
.find( "%", 1 );
2842 field
= line
.mid( 0, end
+ 1 );
2844 if( field
== INDEX_FIELD
)
2847 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
2848 *out
<< INDEX_FIELD_TITLE
;
2850 if( field
== SIGNATURE_FIELD
)
2853 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
2854 *out
<< SIGNATURE_FIELD_TITLE
;
2856 if( field
== MINI_LEX_FIELD
)
2859 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
2860 *out
<< MINI_LEX_FIELD_TITLE
;
2862 if( field
== DESC_LENGTH_FIELD
)
2865 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
2866 *out
<< DESC_LENGTH_FIELD_TITLE
;
2868 if( field
== CORPUS_COUNT_FIELD
)
2871 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
2872 *out
<< CORPUS_COUNT_FIELD_TITLE
;
2874 if( field
== STEM_COUNT_FIELD
)
2877 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
2878 *out
<< STEM_COUNT_FIELD_TITLE
;
2880 if( field
== EXEMPLAR_FIELD
)
2883 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[EXEMPLAR_FIELD
] );
2884 *out
<< EXEMPLAR_FIELD_TITLE
;
2886 if( field
== REMARKS_FIELD
)
2889 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[REMARKS_FIELD
] );
2890 *out
<< REMARKS_FIELD_TITLE
;
2892 if( field
== ROBUSTNESS_FIELD
)
2895 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ROBUSTNESS_FIELD
] );
2896 *out
<< ROBUSTNESS_FIELD_TITLE
;
2899 line
= line
.mid( end
+ 1 );
2906 alphabetized
.sort();
2908 // Output text file stuff
2910 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
2912 pSigs
= ( *m_pLexicon
->GetAllSuffixSigs() )[ *sIt
];
2914 //for( pSig = pSigs->first(); pSig; pSig = pSigs->next() )
2915 for (int z
= 0; z
< pSigs
->size(); z
++)
2916 { pSig
= pSigs
->at(z
);
2919 if( m_allSuffixSigsColumnTitlesFlag
->isChecked() ) *out
<< " ";
2921 line
= m_allSuffixSigsLine
->text();
2923 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
2925 while( line
.length() > 0 )
2927 start
= line
.find( "%" );
2935 *out
<< line
.left( start
);
2936 line
= line
.mid( start
);
2937 end
= line
.find( "%", 1 );
2938 field
= line
.mid( 0, end
+ 1 );
2940 if( field
== INDEX_FIELD
)
2943 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
2946 if( field
== SIGNATURE_FIELD
)
2949 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
2950 *out
<< pSig
->Display( '.', filter
);
2952 if( field
== MINI_LEX_FIELD
)
2955 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
2956 *out
<< pSig
->GetMyMini()->GetIndex() + 1;
2958 if( field
== DESC_LENGTH_FIELD
)
2961 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
2962 *out
<< pSig
->ComputeDLofModel();
2964 if( field
== STEM_COUNT_FIELD
)
2967 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
2968 *out
<< pSig
->GetNumberOfStems();
2970 if( field
== CORPUS_COUNT_FIELD
)
2973 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
2974 *out
<< pSig
->GetCorpusCount();
2976 if( field
== EXEMPLAR_FIELD
)
2979 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[EXEMPLAR_FIELD
] );
2980 *out
<< pSig
->GetStem(0)->Display( filter
);
2982 if( field
== REMARKS_FIELD
)
2985 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[REMARKS_FIELD
] );
2986 *out
<< pSig
->GetRemark();
2988 if( field
== ROBUSTNESS_FIELD
)
2991 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ROBUSTNESS_FIELD
] );
2992 *out
<< pSig
->GetRobustness();
2995 line
= line
.mid( end
+ 1 );
3000 if( m_allSuffixSigsIncludeStemListFlag
->isChecked() )
3003 if( m_allSuffixSigsColumnTitlesFlag
->isChecked() )
3005 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
3006 *out
<< "# -------------------------------------------\n";
3008 for (int stemno
= 0; stemno
< pSig
->GetNumberOfStems(); stemno
++)
3009 { pStem
= pSig
->GetStem(stemno
);
3010 if( count
% 5 == 0 )
3013 if( m_allSuffixSigsColumnTitlesFlag
->isChecked() ) *out
<< " ";
3016 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
3017 *out
<< pStem
->Display( filter
);
3027 delete file
; file
= NULL
;
3028 delete out
; out
= NULL
;
3032 // Write mark-up file
3033 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
3037 file
= new QFile( fileName
+ ".html" );
3038 if( file
->open( QIODevice::WriteOnly
) )
3040 out
= new Q3TextStream( file
);
3041 out
->setEncoding( Q3TextStream::Unicode
);
3043 // Output html file stuff
3044 *out
<< getHTMLHeader( m_projectName
->text(), ALL_SUFFIX_SIGNATURES_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
3046 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
3049 if( m_allSuffixSigsColumnTitlesFlag
->isChecked() )
3051 *out
<< "\t\t\t\t<tr>\n";
3053 line
= m_allSuffixSigsLine
->text();
3055 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3057 while( line
.length() > 0 )
3059 start
= line
.find( "%" );
3060 if( start
< 0 ) break;
3062 line
= line
.mid( start
);
3063 end
= line
.find( "%", 1 );
3064 field
= line
.mid( 0, end
+ 1 );
3066 if( field
== INDEX_FIELD
)
3068 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
3070 if( field
== SIGNATURE_FIELD
)
3072 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
3074 if( field
== MINI_LEX_FIELD
)
3076 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MINI_LEX_FIELD_TITLE
<< "</span></td>\n";
3078 if( field
== DESC_LENGTH_FIELD
)
3080 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
3082 if( field
== CORPUS_COUNT_FIELD
)
3084 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
3086 if( field
== STEM_COUNT_FIELD
)
3088 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
3090 if( field
== EXEMPLAR_FIELD
)
3092 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << EXEMPLAR_FIELD_TITLE
<< "</span></td>\n";
3094 if( field
== REMARKS_FIELD
)
3096 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << REMARKS_FIELD_TITLE
<< "</span></td>\n";
3098 if( field
== ROBUSTNESS_FIELD
)
3100 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\" align=\"center\">" << ROBUSTNESS_FIELD_TITLE
<< "</span></td>\n";
3103 line
= line
.mid( end
+ 1 );
3106 *out
<< "\t\t\t\t</tr>\n";
3110 alphabetized
.sort();
3112 // Output html file stuff
3114 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
3116 pSigs
= ( *m_pLexicon
->GetAllSuffixSigs() )[ *sIt
];
3118 //for( pSig = pSigs->first(); pSig; pSig = pSigs->next() )
3119 for (int z
= 0; z
< pSigs
->size(); z
++)
3120 { pSig
= pSigs
->at(z
);
3121 *out
<< "\t\t\t\t<tr>\n";
3125 line
= m_allSuffixSigsLine
->text();
3127 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3129 while( line
.length() > 0 )
3131 start
= line
.find( "%" );
3132 if( start
< 0 ) break;
3134 line
= line
.mid( start
);
3135 end
= line
.find( "%", 1 );
3136 field
= line
.mid( 0, end
+ 1 );
3138 if( field
== INDEX_FIELD
)
3140 *out
<< "\t\t\t\t\t<td";
3141 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3142 *out
<< ">" << index
<< "</td>\n";
3144 if( field
== SIGNATURE_FIELD
)
3146 url
= m_projectName
->text() + QString( "_Mini_%1_Signatures.html" ).arg( pSig
->GetMyMini()->GetIndex() + 1 );
3147 url
.replace( " ", "_" );
3148 *out
<< "\t\t\t\t\t<td";
3149 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3150 *out
<< "><a name=\"_" + pSig
->Display( NULL
< filter
) + "_\">" << getLParseText( pSig
, TRUE
, FALSE
, "signature", url
) << "</a></td>\n";
3152 if( field
== MINI_LEX_FIELD
)
3154 *out
<< "\t\t\t\t\t<td";
3155 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3156 *out
<< " align=\"center\">" << pSig
->GetMyMini()->GetIndex() + 1 << "</td>\n";
3158 if( field
== DESC_LENGTH_FIELD
)
3160 *out
<< "\t\t\t\t\t<td";
3161 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3162 *out
<< ">" << pSig
->ComputeDLofModel() << "</td>\n";
3164 if( field
== CORPUS_COUNT_FIELD
)
3166 *out
<< "\t\t\t\t\t<td";
3167 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3168 *out
<< " align=\"center\">" << pSig
->GetCorpusCount() << "</td>\n";
3170 if( field
== STEM_COUNT_FIELD
)
3172 *out
<< "\t\t\t\t\t<td";
3173 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3174 *out
<< " align=\"center\">" << pSig
->GetNumberOfStems() << "</td>\n";
3176 if( field
== EXEMPLAR_FIELD
)
3178 *out
<< "\t\t\t\t\t<td";
3179 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3180 *out
<< ">" << getLParseText( pSig
->GetStem(0), TRUE
, FALSE
) << "</td>\n";
3182 if( field
== REMARKS_FIELD
)
3184 *out
<< "\t\t\t\t\t<td";
3185 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3186 *out
<< ">" << pSig
->GetRemark() << "</td>\n";
3188 if( field
== ROBUSTNESS_FIELD
)
3190 *out
<< "\t\t\t\t\t<td";
3191 if( !m_allSuffixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3192 *out
<< " align=\"center\">" << pSig
->GetRobustness() << "</td>\n";
3195 line
= line
.mid( end
+ 1 );
3198 *out
<< "\t\t\t\t</tr>\n";
3200 if( m_allSuffixSigsIncludeStemListFlag
->isChecked() )
3202 *out
<< "\t\t\t\t<tr>\n";
3203 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_allSuffixSigsLine
->text().count( "%" ) / 2 ) << "\">\n";
3204 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
3205 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
3208 *out
<< "\t\t\t\t\t\t\t<tr>\n";
3209 for (int stemno
= 0; stemno
< pSig
->GetNumberOfStems(); stemno
++)
3210 { pStem
= pSig
->GetStem(stemno
);
3211 if( count
> 0 && count
% 5 == 0 )
3213 *out
<< "\t\t\t\t\t\t\t</tr>\n";
3214 *out
<< "\t\t\t\t\t\t\t<tr>\n";
3217 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
) << "</td>\n";
3220 while( count
> 5 && count
% 5 != 0 )
3222 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
3226 *out
<< "\t\t\t\t\t\t\t</tr>\n";
3228 *out
<< "\t\t\t\t\t\t</table><br>\n";
3229 *out
<< "\t\t\t\t\t</td>\n";
3230 *out
<< "\t\t\t\t</tr>\n";
3233 if( index
% 20 == 0 )
3235 *out
<< "\t\t\t\t<tr>\n";
3236 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_allSuffixSigsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
3237 *out
<< "\t\t\t\t</tr>\n";
3242 *out
<< "\t\t\t</table>\n";
3244 *out
<< getHTMLFooter();
3247 delete file
; file
= NULL
;
3248 delete out
; out
= NULL
;
3254 void ExportWizard::exportAllSuffixes()
3259 SuffixSet
* pSuffixes
;
3264 StringToString
* filter
= m_pLexicon
->GetOutFilter();
3266 QMap
<QString
,int> fieldWidths
;
3267 int width
, count
, start
, end
, index
;
3269 QString line
, field
,
3270 fileName
= m_projectName
->text() + "_" + ALL_SUFFIXES_FILE_TITLE
;
3272 QStringList alphabetized
;
3274 fileName
.replace( " ", "_" );
3276 Q3DictIterator
<SuffixSet
> it( *m_pLexicon
->GetAllSuffixes() );
3278 // Get all words for alphabetization
3279 for( ; it
.current(); ++it
)
3281 alphabetized
.append( it
.currentKey() );
3284 // Write simple text file
3285 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
3287 file
= new QFile( fileName
+ ".txt" );
3288 if( file
->open( QIODevice::WriteOnly
) )
3290 fieldWidths
.clear();
3293 if( m_allSuffixesUniformFieldWidthsFlag
->isChecked() )
3295 if( m_allSuffixesColumnTitlesFlag
->isChecked() )
3297 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
3298 fieldWidths
[SUFFIX_FIELD
] = SUFFIX_FIELD_TITLE
.length();
3299 fieldWidths
[MINI_LEX_FIELD
] = MINI_LEX_FIELD_TITLE
.length();
3300 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
3301 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
3302 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
3303 if( m_allSuffixesIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
3308 for( ; it
.current(); ++it
)
3310 pSuffixes
= it
.current();
3312 //for( pSuffix = pSuffixes->first(); pSuffix; pSuffix = pSuffixes->next() )
3313 for (int z
= 0; z
< pSuffixes
->size(); z
++)
3314 { pSuffix
= pSuffixes
->at(z
);
3317 if( m_allSuffixesLine
->text().find( INDEX_FIELD
) >= 0 )
3319 width
= QString( "%1" ).arg( index
).length();
3320 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
3322 if( m_allSuffixesLine
->text().find( SUFFIX_FIELD
) >= 0 )
3324 width
= pSuffix
->Display( filter
).length();
3325 if( width
> fieldWidths
[SUFFIX_FIELD
] ) fieldWidths
[SUFFIX_FIELD
] = width
;
3327 if( m_allSuffixesLine
->text().find( MINI_LEX_FIELD
) >= 0 )
3329 width
= QString( "%1" ).arg( pSuffix
->GetMyMini()->GetIndex() + 1 ).length();
3330 if( width
> fieldWidths
[MINI_LEX_FIELD
] ) fieldWidths
[MINI_LEX_FIELD
] = width
;
3332 if( m_allSuffixesLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
3334 width
= QString( "%1" ).arg( pSuffix
->ComputeDL() ).length();
3335 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
3337 if( m_allSuffixesLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
3339 width
= QString( "%1" ).arg( pSuffix
->GetCorpusCount() ).length();
3340 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
3342 if( m_allSuffixesLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
3344 width
= QString( "%1" ).arg( pSuffix
->GetNumberOfStems() ).length();
3345 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
3348 if( m_allSuffixesIncludeStemListFlag
->isChecked() )
3351 for (int i
= 0; i
< pSuffix
->GetStems()->size(); i
++)
3352 //for( pStem = pSuffix->GetStems()->first(); pStem; pStem = pSuffix->GetStems()->next() )
3354 pStem
= pSuffix
->GetStems()->at(i
);
3355 if( width
< (static_cast <int> (pStem
->Display( filter
).length()) ) ) width
= static_cast <int> ( pStem
->Display( filter
).length());
3357 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
3364 out
= new Q3TextStream( file
);
3365 out
->setEncoding( Q3TextStream::Unicode
);
3369 if( m_allSuffixesColumnTitlesFlag
->isChecked() )
3373 line
= m_allSuffixesLine
->text();
3375 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3377 while( line
.length() > 0 )
3379 start
= line
.find( "%" );
3387 *out
<< line
.left( start
);
3388 line
= line
.mid( start
);
3389 end
= line
.find( "%", 1 );
3390 field
= line
.mid( 0, end
+ 1 );
3392 if( field
== INDEX_FIELD
)
3395 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
3396 *out
<< INDEX_FIELD_TITLE
;
3398 if( field
== SUFFIX_FIELD
)
3401 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
3402 *out
<< SUFFIX_FIELD_TITLE
;
3404 if( field
== MINI_LEX_FIELD
)
3407 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
3408 *out
<< MINI_LEX_FIELD_TITLE
;
3410 if( field
== DESC_LENGTH_FIELD
)
3413 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
3414 *out
<< DESC_LENGTH_FIELD_TITLE
;
3416 if( field
== CORPUS_COUNT_FIELD
)
3419 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
3420 *out
<< CORPUS_COUNT_FIELD_TITLE
;
3422 if( field
== STEM_COUNT_FIELD
)
3425 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
3426 *out
<< STEM_COUNT_FIELD_TITLE
;
3429 line
= line
.mid( end
+ 1 );
3436 alphabetized
.sort();
3438 // Output text file stuff
3440 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
3442 pSuffixes
= ( *m_pLexicon
->GetAllSuffixes() )[ *sIt
];
3444 //for( pSuffix = pSuffixes->first(); pSuffix; pSuffix = pSuffixes->next() )
3445 for (int z
= 0; z
< pSuffixes
->size(); z
++)
3446 { pSuffix
= pSuffixes
->at(z
);
3449 if( m_allSuffixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
3451 line
= m_allSuffixesLine
->text();
3453 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3455 while( line
.length() > 0 )
3457 start
= line
.find( "%" );
3465 *out
<< line
.left( start
);
3466 line
= line
.mid( start
);
3467 end
= line
.find( "%", 1 );
3468 field
= line
.mid( 0, end
+ 1 );
3470 if( field
== INDEX_FIELD
)
3473 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
3476 if( field
== SUFFIX_FIELD
)
3479 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
3480 *out
<< pSuffix
->Display( '.', filter
);
3482 if( field
== MINI_LEX_FIELD
)
3485 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
3486 *out
<< pSuffix
->GetMyMini()->GetIndex() + 1;
3488 if( field
== DESC_LENGTH_FIELD
)
3491 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
3492 *out
<< pSuffix
->ComputeDL();
3494 if( field
== STEM_COUNT_FIELD
)
3497 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
3498 *out
<< pSuffix
->GetStems()->count();
3500 if( field
== CORPUS_COUNT_FIELD
)
3503 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
3504 *out
<< pSuffix
->GetCorpusCount();
3507 line
= line
.mid( end
+ 1 );
3512 if( m_allSuffixesIncludeStemListFlag
->isChecked() )
3515 if( m_allSuffixesColumnTitlesFlag
->isChecked() )
3517 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
3518 *out
<< "# -------------------------------------------\n";
3520 //for( pStem = pSuffix->GetStems()->first(); pStem; pStem = pSuffix->GetStems()->next() )
3521 for (int z
= 0; z
< pSuffix
->GetStems()->size(); z
++)
3522 { pStem
= pSuffix
->GetStems()->at(z
);
3523 if( count
% 5 == 0 )
3527 if( m_allSuffixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
3531 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
3532 *out
<< pStem
->Display( filter
);
3542 delete file
; file
= NULL
;
3543 delete out
; out
= NULL
;
3547 // Write mark-up file
3548 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
3552 file
= new QFile( fileName
+ ".html" );
3553 if( file
->open( QIODevice::WriteOnly
) )
3555 out
= new Q3TextStream( file
);
3556 out
->setEncoding( Q3TextStream::Unicode
);
3558 // Output html file stuff
3559 *out
<< getHTMLHeader( m_projectName
->text(), ALL_SUFFIXES_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
3561 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
3564 if( m_allSuffixesColumnTitlesFlag
->isChecked() )
3566 *out
<< "\t\t\t\t<tr>\n";
3568 line
= m_allSuffixesLine
->text();
3570 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3572 while( line
.length() > 0 )
3574 start
= line
.find( "%" );
3575 if( start
< 0 ) break;
3577 line
= line
.mid( start
);
3578 end
= line
.find( "%", 1 );
3579 field
= line
.mid( 0, end
+ 1 );
3581 if( field
== INDEX_FIELD
)
3583 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
3585 if( field
== SUFFIX_FIELD
)
3587 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SUFFIX_FIELD_TITLE
<< "</span></td>\n";
3589 if( field
== MINI_LEX_FIELD
)
3591 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MINI_LEX_FIELD_TITLE
<< "</span></td>\n";
3593 if( field
== DESC_LENGTH_FIELD
)
3595 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
3597 if( field
== CORPUS_COUNT_FIELD
)
3599 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
3601 if( field
== STEM_COUNT_FIELD
)
3603 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
3606 line
= line
.mid( end
+ 1 );
3609 *out
<< "\t\t\t\t</tr>\n";
3613 alphabetized
.sort();
3615 // Output html file stuff
3617 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
3619 pSuffixes
= ( *m_pLexicon
->GetAllSuffixes() )[ *sIt
];
3621 //for( pSuffix = pSuffixes->first(); pSuffix; pSuffix = pSuffixes->next() )
3622 for (int y
= 0; y
< pSuffixes
->size(); y
++)
3623 { pSuffix
= pSuffixes
->at(y
);
3624 *out
<< "\t\t\t\t<tr>\n";
3628 line
= m_allSuffixesLine
->text();
3630 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3632 while( line
.length() > 0 )
3634 start
= line
.find( "%" );
3635 if( start
< 0 ) break;
3637 line
= line
.mid( start
);
3638 end
= line
.find( "%", 1 );
3639 field
= line
.mid( 0, end
+ 1 );
3641 if( field
== INDEX_FIELD
)
3643 *out
<< "\t\t\t\t\t<td";
3644 if( !m_allSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3645 *out
<< ">" << index
<< "</td>\n";
3647 if( field
== SUFFIX_FIELD
)
3649 url
= m_projectName
->text() + QString( "_Mini_%1_Suffixes.html" ).arg( pSuffix
->GetMyMini()->GetIndex() + 1 );
3650 url
.replace( " ", "_" );
3651 *out
<< "\t\t\t\t\t<td";
3652 if( !m_allSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3653 *out
<< "><a name=\"_" + pSuffix
->Display() + "_\">" << getLParseText( pSuffix
, TRUE
, FALSE
, "suffix", url
) << "</a></td>\n";
3655 if( field
== MINI_LEX_FIELD
)
3657 *out
<< "\t\t\t\t\t<td";
3658 if( !m_allSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3659 *out
<< " align=\"center\">" << pSuffix
->GetMyMini()->GetIndex() + 1 << "</td>\n";
3661 if( field
== DESC_LENGTH_FIELD
)
3663 *out
<< "\t\t\t\t\t<td";
3664 if( !m_allSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3665 *out
<< ">" << pSuffix
->ComputeDL() << "</td>\n";
3667 if( field
== CORPUS_COUNT_FIELD
)
3669 *out
<< "\t\t\t\t\t<td";
3670 if( !m_allSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3671 *out
<< " align=\"center\">" << pSuffix
->GetCorpusCount() << "</td>\n";
3673 if( field
== STEM_COUNT_FIELD
)
3675 *out
<< "\t\t\t\t\t<td";
3676 if( !m_allSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
3677 *out
<< " align=\"center\">" << pSuffix
->GetStems()->count() << "</td>\n";
3680 line
= line
.mid( end
+ 1 );
3683 *out
<< "\t\t\t\t</tr>\n";
3685 if( m_allSuffixesIncludeStemListFlag
->isChecked() )
3687 *out
<< "\t\t\t\t<tr>\n";
3688 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_allSuffixesLine
->text().count( "%" ) / 2 ) << "\">\n";
3689 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
3690 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
3693 *out
<< "\t\t\t\t\t\t\t<tr>\n";
3695 //for( pStem = pSuffix->GetStems()->first(); pStem; pStem = pSuffix->GetStems()->next() )
3696 for (int z
= 0; z
< pSuffix
->GetStems()->size(); z
++)
3697 { pStem
= pSuffix
->GetStems() -> at(z
);
3698 if( count
> 0 && count
% 5 == 0 )
3700 *out
<< "\t\t\t\t\t\t\t</tr>\n";
3701 *out
<< "\t\t\t\t\t\t\t<tr>\n";
3704 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
) << "</td>\n";
3707 while( count
> 5 && count
% 5 != 0 )
3709 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
3713 *out
<< "\t\t\t\t\t\t\t</tr>\n";
3715 *out
<< "\t\t\t\t\t\t</table><br>\n";
3716 *out
<< "\t\t\t\t\t</td>\n";
3717 *out
<< "\t\t\t\t</tr>\n";
3720 if( index
% 20 == 0 )
3722 *out
<< "\t\t\t\t<tr>\n";
3723 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_allSuffixesLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
3724 *out
<< "\t\t\t\t</tr>\n";
3729 *out
<< "\t\t\t</table>\n";
3731 *out
<< getHTMLFooter();
3734 delete file
; file
= NULL
;
3735 delete out
; out
= NULL
;
3741 void ExportWizard::exportAllPrefixSigs()
3746 SignatureSet
* pSigs
;
3751 StringToString
* filter
= m_pLexicon
->GetOutFilter();
3753 QMap
<QString
,int> fieldWidths
;
3754 int width
, count
, start
, end
, index
;
3756 QString line
, field
,
3757 fileName
= m_projectName
->text() + "_" + ALL_PREFIX_SIGNATURES_FILE_TITLE
;
3759 QStringList alphabetized
;
3761 fileName
.replace( " ", "_" );
3763 Q3DictIterator
<SignatureSet
> it( *m_pLexicon
->GetAllPrefixSigs() );
3765 // Get all words for alphabetization
3766 for( ; it
.current(); ++it
)
3768 alphabetized
.append( it
.currentKey() );
3771 // Write simple text file
3772 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
3774 file
= new QFile( fileName
+ ".txt" );
3775 if( file
->open( QIODevice::WriteOnly
) )
3777 fieldWidths
.clear();
3780 if( m_allPrefixSigsUniformFieldWidthsFlag
->isChecked() )
3782 if( m_allPrefixSigsColumnTitlesFlag
->isChecked() )
3784 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
3785 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
3786 fieldWidths
[MINI_LEX_FIELD
] = MINI_LEX_FIELD_TITLE
.length();
3787 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
3788 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
3789 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
3790 fieldWidths
[EXEMPLAR_FIELD
] = EXEMPLAR_FIELD_TITLE
.length();
3791 fieldWidths
[REMARKS_FIELD
] = REMARKS_FIELD_TITLE
.length();
3792 fieldWidths
[ROBUSTNESS_FIELD
] = ROBUSTNESS_FIELD_TITLE
.length();
3793 if( m_allPrefixSigsIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
3798 for( ; it
.current(); ++it
)
3800 pSigs
= it
.current();
3802 //for( pSig = pSigs->first(); pSig; pSig = pSigs->next() )
3803 for (int z
= 0; z
< pSigs
->size(); z
++)
3804 { pSig
= pSigs
->at(z
);
3807 if( m_allPrefixSigsLine
->text().find( INDEX_FIELD
) >= 0 )
3809 width
= QString( "%1" ).arg( index
).length();
3810 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
3812 if( m_allPrefixSigsLine
->text().find( SIGNATURE_FIELD
) >= 0 )
3814 width
= pSig
->Display( '.', filter
).length();
3815 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
3817 if( m_allPrefixSigsLine
->text().find( MINI_LEX_FIELD
) >= 0 )
3819 width
= QString( "%1" ).arg( pSig
->GetMyMini()->GetIndex() + 1 ).length();
3820 if( width
> fieldWidths
[MINI_LEX_FIELD
] ) fieldWidths
[MINI_LEX_FIELD
] = width
;
3822 if( m_allPrefixSigsLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
3824 width
= QString( "%1" ).arg( pSig
->ComputeDLofModel() ).length();
3825 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
3827 if( m_allPrefixSigsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
3829 width
= QString( "%1" ).arg( pSig
->GetCorpusCount() ).length();
3830 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
3832 if( m_allPrefixSigsLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
3834 width
= QString( "%1" ).arg( pSig
->GetNumberOfStems() ).length();
3835 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
3837 if( m_allPrefixSigsLine
->text().find( EXEMPLAR_FIELD
) >= 0 )
3839 width
= pSig
->GetStem(0)->Display( filter
).length();
3840 if( width
> fieldWidths
[EXEMPLAR_FIELD
] ) fieldWidths
[EXEMPLAR_FIELD
] = width
;
3842 if( m_allPrefixSigsLine
->text().find( REMARKS_FIELD
) >= 0 )
3844 width
= pSig
->GetRemark().length();
3845 if( width
> fieldWidths
[REMARKS_FIELD
] ) fieldWidths
[REMARKS_FIELD
] = width
;
3847 if( m_allPrefixSigsLine
->text().find( ROBUSTNESS_FIELD
) >= 0 )
3849 width
= QString( "%1" ).arg( pSig
->GetRobustness() ).length();
3850 if( width
> fieldWidths
[ROBUSTNESS_FIELD
] ) fieldWidths
[ROBUSTNESS_FIELD
] = width
;
3853 if( m_allPrefixSigsIncludeStemListFlag
->isChecked() )
3856 //for( pStem = pSig->GetStem(0); pStem; pStem = pSig->GetStemPtrList()->next() )
3857 for (int z
= 0; z
< pSig
->GetNumberOfStems(); z
++)
3858 { pStem
= pSig
->GetStem(z
);
3859 if( width
< static_cast <int> (pStem
->Display( filter
).length()) ) width
= static_cast <int> ( pStem
->Display( filter
).length());
3861 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
3868 out
= new Q3TextStream( file
);
3869 out
->setEncoding( Q3TextStream::Unicode
);
3873 if( m_allPrefixSigsColumnTitlesFlag
->isChecked() )
3877 line
= m_allPrefixSigsLine
->text();
3879 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3881 while( line
.length() > 0 )
3883 start
= line
.find( "%" );
3891 *out
<< line
.left( start
);
3892 line
= line
.mid( start
);
3893 end
= line
.find( "%", 1 );
3894 field
= line
.mid( 0, end
+ 1 );
3896 if( field
== INDEX_FIELD
)
3899 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
3900 *out
<< INDEX_FIELD_TITLE
;
3902 if( field
== SIGNATURE_FIELD
)
3905 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
3906 *out
<< SIGNATURE_FIELD_TITLE
;
3908 if( field
== MINI_LEX_FIELD
)
3911 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
3912 *out
<< MINI_LEX_FIELD_TITLE
;
3914 if( field
== DESC_LENGTH_FIELD
)
3917 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
3918 *out
<< DESC_LENGTH_FIELD_TITLE
;
3920 if( field
== CORPUS_COUNT_FIELD
)
3923 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
3924 *out
<< CORPUS_COUNT_FIELD_TITLE
;
3926 if( field
== STEM_COUNT_FIELD
)
3929 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
3930 *out
<< STEM_COUNT_FIELD_TITLE
;
3932 if( field
== EXEMPLAR_FIELD
)
3935 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[EXEMPLAR_FIELD
] );
3936 *out
<< EXEMPLAR_FIELD_TITLE
;
3938 if( field
== REMARKS_FIELD
)
3941 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[REMARKS_FIELD
] );
3942 *out
<< REMARKS_FIELD_TITLE
;
3944 if( field
== ROBUSTNESS_FIELD
)
3947 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ROBUSTNESS_FIELD
] );
3948 *out
<< ROBUSTNESS_FIELD_TITLE
;
3951 line
= line
.mid( end
+ 1 );
3958 alphabetized
.sort();
3960 // Output text file stuff
3962 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
3964 pSigs
= ( *m_pLexicon
->GetAllPrefixSigs() )[ *sIt
];
3966 //for( pSig = pSigs->first(); pSig; pSig = pSigs->next() )
3967 for (int z
= 0; z
< pSigs
->size(); z
++)
3968 { pSig
= pSigs
->at(z
);
3971 if( m_allPrefixSigsColumnTitlesFlag
->isChecked() ) *out
<< " ";
3973 line
= m_allPrefixSigsLine
->text();
3975 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
3977 while( line
.length() > 0 )
3979 start
= line
.find( "%" );
3987 *out
<< line
.left( start
);
3988 line
= line
.mid( start
);
3989 end
= line
.find( "%", 1 );
3990 field
= line
.mid( 0, end
+ 1 );
3992 if( field
== INDEX_FIELD
)
3995 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
3998 if( field
== SIGNATURE_FIELD
)
4001 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
4002 *out
<< pSig
->Display( '.', filter
);
4004 if( field
== MINI_LEX_FIELD
)
4007 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
4008 *out
<< pSig
->GetMyMini()->GetIndex() + 1;
4010 if( field
== DESC_LENGTH_FIELD
)
4013 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
4014 *out
<< pSig
->ComputeDLofModel();
4016 if( field
== STEM_COUNT_FIELD
)
4019 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
4020 *out
<< pSig
->GetNumberOfStems();
4022 if( field
== CORPUS_COUNT_FIELD
)
4025 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
4026 *out
<< pSig
->GetCorpusCount();
4028 if( field
== EXEMPLAR_FIELD
)
4031 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[EXEMPLAR_FIELD
] );
4032 *out
<< pSig
->GetStem(0)->Display( filter
);
4034 if( field
== REMARKS_FIELD
)
4037 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[REMARKS_FIELD
] );
4038 *out
<< pSig
->GetRemark();
4040 if( field
== ROBUSTNESS_FIELD
)
4043 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ROBUSTNESS_FIELD
] );
4044 *out
<< pSig
->GetRobustness();
4047 line
= line
.mid( end
+ 1 );
4052 if( m_allPrefixSigsIncludeStemListFlag
->isChecked() )
4055 if( m_allPrefixSigsColumnTitlesFlag
->isChecked() )
4057 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
4058 *out
<< "# -------------------------------------------\n";
4060 //for( pStem = pSig->GetStem(0); pStem; pStem = pSig->GetStemPtrList()->next() )
4061 for (int z
= 0; z
< pSig
->GetNumberOfStems(); z
++)
4062 { pStem
= pSig
->GetStem(z
);
4063 if( count
% 5 == 0 )
4067 if( m_allPrefixSigsColumnTitlesFlag
->isChecked() ) *out
<< " ";
4071 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
4072 *out
<< pStem
->Display( filter
);
4082 delete file
; file
= NULL
;
4083 delete out
; out
= NULL
;
4087 // Write mark-up file
4088 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
4092 file
= new QFile( fileName
+ ".html" );
4093 if( file
->open( QIODevice::WriteOnly
) )
4095 out
= new Q3TextStream( file
);
4096 out
->setEncoding( Q3TextStream::Unicode
);
4098 // Output html file stuff
4099 *out
<< getHTMLHeader( m_projectName
->text(), ALL_PREFIX_SIGNATURES_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
4101 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
4104 if( m_allPrefixSigsColumnTitlesFlag
->isChecked() )
4106 *out
<< "\t\t\t\t<tr>\n";
4108 line
= m_allPrefixSigsLine
->text();
4110 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4112 while( line
.length() > 0 )
4114 start
= line
.find( "%" );
4115 if( start
< 0 ) break;
4117 line
= line
.mid( start
);
4118 end
= line
.find( "%", 1 );
4119 field
= line
.mid( 0, end
+ 1 );
4121 if( field
== INDEX_FIELD
)
4123 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
4125 if( field
== SIGNATURE_FIELD
)
4127 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
4129 if( field
== MINI_LEX_FIELD
)
4131 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MINI_LEX_FIELD_TITLE
<< "</span></td>\n";
4133 if( field
== DESC_LENGTH_FIELD
)
4135 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
4137 if( field
== CORPUS_COUNT_FIELD
)
4139 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
4141 if( field
== STEM_COUNT_FIELD
)
4143 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
4145 if( field
== EXEMPLAR_FIELD
)
4147 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << EXEMPLAR_FIELD_TITLE
<< "</span></td>\n";
4149 if( field
== REMARKS_FIELD
)
4151 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << REMARKS_FIELD_TITLE
<< "</span></td>\n";
4153 if( field
== ROBUSTNESS_FIELD
)
4155 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\" align=\"center\">" << ROBUSTNESS_FIELD_TITLE
<< "</span></td>\n";
4158 line
= line
.mid( end
+ 1 );
4161 *out
<< "\t\t\t\t</tr>\n";
4165 alphabetized
.sort();
4167 // Output html file stuff
4169 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
4171 pSigs
= ( *m_pLexicon
->GetAllPrefixSigs() )[ *sIt
];
4173 //for( pSig = pSigs->first(); pSig; pSig = pSigs->next() )
4174 for (int z
= 0; z
< pSigs
->size(); z
++)
4175 { pSig
= pSigs
->at(z
);
4176 *out
<< "\t\t\t\t<tr>\n";
4180 line
= m_allPrefixSigsLine
->text();
4182 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4184 while( line
.length() > 0 )
4186 start
= line
.find( "%" );
4187 if( start
< 0 ) break;
4189 line
= line
.mid( start
);
4190 end
= line
.find( "%", 1 );
4191 field
= line
.mid( 0, end
+ 1 );
4193 if( field
== INDEX_FIELD
)
4195 *out
<< "\t\t\t\t\t<td";
4196 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4197 *out
<< ">" << index
<< "</td>\n";
4199 if( field
== SIGNATURE_FIELD
)
4201 url
= m_projectName
->text() + QString( "_Mini_%1_Signatures.html" ).arg( pSig
->GetMyMini()->GetIndex() + 1 );
4202 url
.replace( " ", "_" );
4203 *out
<< "\t\t\t\t\t<td";
4204 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4205 *out
<< "><a name=\"_" + pSig
->Display( filter
) + "_\">" << getLParseText( pSig
, TRUE
, FALSE
, "signature", url
) << "</a></td>\n";
4207 if( field
== MINI_LEX_FIELD
)
4209 *out
<< "\t\t\t\t\t<td";
4210 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4211 *out
<< " align=\"center\">" << pSig
->GetMyMini()->GetIndex() + 1 << "</td>\n";
4213 if( field
== DESC_LENGTH_FIELD
)
4215 *out
<< "\t\t\t\t\t<td";
4216 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4217 *out
<< ">" << pSig
->ComputeDLofModel() << "</td>\n";
4219 if( field
== CORPUS_COUNT_FIELD
)
4221 *out
<< "\t\t\t\t\t<td";
4222 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4223 *out
<< " align=\"center\">" << pSig
->GetCorpusCount() << "</td>\n";
4225 if( field
== STEM_COUNT_FIELD
)
4227 *out
<< "\t\t\t\t\t<td";
4228 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4229 *out
<< " align=\"center\">" << pSig
->GetNumberOfStems() << "</td>\n";
4231 if( field
== EXEMPLAR_FIELD
)
4233 *out
<< "\t\t\t\t\t<td";
4234 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4235 *out
<< ">" << getLParseText( pSig
->GetStem(0), TRUE
, FALSE
) << "</td>\n";
4237 if( field
== REMARKS_FIELD
)
4239 *out
<< "\t\t\t\t\t<td";
4240 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4241 *out
<< ">" << pSig
->GetRemark() << "</td>\n";
4243 if( field
== ROBUSTNESS_FIELD
)
4245 *out
<< "\t\t\t\t\t<td";
4246 if( !m_allPrefixSigsIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4247 *out
<< " align=\"center\">" << pSig
->GetRobustness() << "</td>\n";
4250 line
= line
.mid( end
+ 1 );
4253 *out
<< "\t\t\t\t</tr>\n";
4255 if( m_allPrefixSigsIncludeStemListFlag
->isChecked() )
4257 *out
<< "\t\t\t\t<tr>\n";
4258 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_allPrefixSigsLine
->text().count( "%" ) / 2 ) << "\">\n";
4259 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
4260 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
4263 *out
<< "\t\t\t\t\t\t\t<tr>\n";
4264 //for( pStem = pSig->GetStem(0); pStem; pStem = pSig->GetStemPtrList()->next() )
4265 for (int z
= 0; z
< pSig
->GetNumberOfStems();z
++)
4266 { pStem
= pSig
->GetStem(z
);
4267 if( count
> 0 && count
% 5 == 0 )
4269 *out
<< "\t\t\t\t\t\t\t</tr>\n";
4270 *out
<< "\t\t\t\t\t\t\t<tr>\n";
4273 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
) << "</td>\n";
4276 while( count
> 5 && count
% 5 != 0 )
4278 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
4282 *out
<< "\t\t\t\t\t\t\t</tr>\n";
4284 *out
<< "\t\t\t\t\t\t</table><br>\n";
4285 *out
<< "\t\t\t\t\t</td>\n";
4286 *out
<< "\t\t\t\t</tr>\n";
4289 if( index
% 20 == 0 )
4291 *out
<< "\t\t\t\t<tr>\n";
4292 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_allPrefixSigsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
4293 *out
<< "\t\t\t\t</tr>\n";
4298 *out
<< "\t\t\t</table>\n";
4300 *out
<< getHTMLFooter();
4303 delete file
; file
= NULL
;
4304 delete out
; out
= NULL
;
4310 void ExportWizard::exportAllPrefixes()
4315 PrefixSet
* pPrefixes
;
4320 StringToString
* filter
= m_pLexicon
->GetOutFilter();
4322 QMap
<QString
,int> fieldWidths
;
4323 int width
, count
, start
, end
, index
;
4325 QString line
, field
,
4326 fileName
= m_projectName
->text() + "_" + ALL_PREFIXES_FILE_TITLE
;
4328 QStringList alphabetized
;
4330 fileName
.replace( " ", "_" );
4332 Q3DictIterator
<PrefixSet
> it( *m_pLexicon
->GetAllPrefixes() );
4334 // Get all words for alphabetization
4335 for( ; it
.current(); ++it
)
4337 alphabetized
.append( it
.currentKey() );
4340 // Write simple text file
4341 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
4343 file
= new QFile( fileName
+ ".txt" );
4344 if( file
->open( QIODevice::WriteOnly
) )
4346 fieldWidths
.clear();
4349 if( m_allPrefixesUniformFieldWidthsFlag
->isChecked() )
4351 if( m_allPrefixesColumnTitlesFlag
->isChecked() )
4353 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
4354 fieldWidths
[PREFIX_FIELD
] = PREFIX_FIELD_TITLE
.length();
4355 fieldWidths
[MINI_LEX_FIELD
] = MINI_LEX_FIELD_TITLE
.length();
4356 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
4357 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
4358 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
4359 if( m_allPrefixesIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
4364 for( ; it
.current(); ++it
)
4366 pPrefixes
= it
.current();
4368 //for( pPrefix = pPrefixes->first(); pPrefix; pPrefix = pPrefixes->next() )
4369 for (int z
= 0; z
< pPrefixes
->size(); z
++)
4370 { pPrefix
= pPrefixes
->at(z
);
4373 if( m_allPrefixesLine
->text().find( INDEX_FIELD
) >= 0 )
4375 width
= QString( "%1" ).arg( index
).length();
4376 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
4378 if( m_allPrefixesLine
->text().find( PREFIX_FIELD
) >= 0 )
4380 width
= pPrefix
->Display( filter
).length();
4381 if( width
> fieldWidths
[PREFIX_FIELD
] ) fieldWidths
[PREFIX_FIELD
] = width
;
4383 if( m_allPrefixesLine
->text().find( MINI_LEX_FIELD
) >= 0 )
4385 width
= QString( "%1" ).arg( pPrefix
->GetMyMini()->GetIndex() + 1 ).length();
4386 if( width
> fieldWidths
[MINI_LEX_FIELD
] ) fieldWidths
[MINI_LEX_FIELD
] = width
;
4388 if( m_allPrefixesLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
4390 width
= QString( "%1" ).arg( pPrefix
->ComputeDL() ).length();
4391 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
4393 if( m_allPrefixesLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
4395 width
= QString( "%1" ).arg( pPrefix
->GetCorpusCount() ).length();
4396 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
4398 if( m_allPrefixesLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
4400 width
= QString( "%1" ).arg( pPrefix
->GetNumberOfStems() ).length();
4401 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
4404 if( m_allPrefixesIncludeStemListFlag
->isChecked() )
4407 //for( pStem = pPrefix->GetStems()->first(); pStem; pStem = pPrefix->GetStems()->next() )
4408 for (int z
= 0; z
< pPrefix
->GetStems()->size(); z
++)
4410 pStem
= pPrefix
->GetStems()->at(z
);
4411 if( width
< static_cast <int> (pStem
->Display( filter
).length())) width
= static_cast <int> (pStem
->Display( filter
).length());
4413 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
4420 out
= new Q3TextStream( file
);
4421 out
->setEncoding( Q3TextStream::Unicode
);
4425 if( m_allPrefixesColumnTitlesFlag
->isChecked() )
4429 line
= m_allPrefixesLine
->text();
4431 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4433 while( line
.length() > 0 )
4435 start
= line
.find( "%" );
4443 *out
<< line
.left( start
);
4444 line
= line
.mid( start
);
4445 end
= line
.find( "%", 1 );
4446 field
= line
.mid( 0, end
+ 1 );
4448 if( field
== INDEX_FIELD
)
4451 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
4452 *out
<< INDEX_FIELD_TITLE
;
4454 if( field
== PREFIX_FIELD
)
4457 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
4458 *out
<< PREFIX_FIELD_TITLE
;
4460 if( field
== MINI_LEX_FIELD
)
4463 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
4464 *out
<< MINI_LEX_FIELD_TITLE
;
4466 if( field
== DESC_LENGTH_FIELD
)
4469 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
4470 *out
<< DESC_LENGTH_FIELD_TITLE
;
4472 if( field
== CORPUS_COUNT_FIELD
)
4475 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
4476 *out
<< CORPUS_COUNT_FIELD_TITLE
;
4478 if( field
== STEM_COUNT_FIELD
)
4481 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
4482 *out
<< STEM_COUNT_FIELD_TITLE
;
4485 line
= line
.mid( end
+ 1 );
4492 alphabetized
.sort();
4494 // Output text file stuff
4496 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
4498 pPrefixes
= ( *m_pLexicon
->GetAllPrefixes() )[ *sIt
];
4500 //for( pPrefix = pPrefixes->first(); pPrefix; pPrefix = pPrefixes->next() )
4501 for (int z
= 0; z
< pPrefixes
->size(); z
++)
4502 { pPrefix
= pPrefixes
->at(z
);
4505 if( m_allPrefixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
4507 line
= m_allPrefixesLine
->text();
4509 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4511 while( line
.length() > 0 )
4513 start
= line
.find( "%" );
4521 *out
<< line
.left( start
);
4522 line
= line
.mid( start
);
4523 end
= line
.find( "%", 1 );
4524 field
= line
.mid( 0, end
+ 1 );
4526 if( field
== INDEX_FIELD
)
4529 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
4532 if( field
== PREFIX_FIELD
)
4535 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
4536 *out
<< pPrefix
->Display( '.', filter
);
4538 if( field
== MINI_LEX_FIELD
)
4541 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[MINI_LEX_FIELD
] );
4542 *out
<< pPrefix
->GetMyMini()->GetIndex() + 1;
4544 if( field
== DESC_LENGTH_FIELD
)
4547 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
4548 *out
<< pPrefix
->ComputeDL();
4550 if( field
== STEM_COUNT_FIELD
)
4553 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
4554 *out
<< pPrefix
->GetStems()->count();
4556 if( field
== CORPUS_COUNT_FIELD
)
4559 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
4560 *out
<< pPrefix
->GetCorpusCount();
4563 line
= line
.mid( end
+ 1 );
4568 if( m_allPrefixesIncludeStemListFlag
->isChecked() )
4571 if( m_allPrefixesColumnTitlesFlag
->isChecked() )
4573 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
4574 *out
<< "# -------------------------------------------\n";
4576 //for( pStem = pPrefix->GetStems()->first(); pStem; pStem = pPrefix->GetStems()->next() )
4577 for (int z
= 0; z
< pPrefix
->GetStems()->size(); z
++)
4579 pStem
= pPrefix
->GetStems()->at(z
);
4580 if( count
% 5 == 0 )
4584 if( m_allPrefixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
4588 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
4589 *out
<< pStem
->Display( filter
);
4599 delete file
; file
= NULL
;
4600 delete out
; out
= NULL
;
4604 // Write mark-up file
4605 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
4609 file
= new QFile( fileName
+ ".html" );
4610 if( file
->open( QIODevice::WriteOnly
) )
4612 out
= new Q3TextStream( file
);
4613 out
->setEncoding( Q3TextStream::Unicode
);
4615 // Output html file stuff
4616 *out
<< getHTMLHeader( m_projectName
->text(), ALL_PREFIXES_FILE_TITLE
, m_language
->text(), m_researchers
->text() );
4618 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
4621 if( m_allPrefixesColumnTitlesFlag
->isChecked() )
4623 *out
<< "\t\t\t\t<tr>\n";
4625 line
= m_allPrefixesLine
->text();
4627 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4629 while( line
.length() > 0 )
4631 start
= line
.find( "%" );
4632 if( start
< 0 ) break;
4634 line
= line
.mid( start
);
4635 end
= line
.find( "%", 1 );
4636 field
= line
.mid( 0, end
+ 1 );
4638 if( field
== INDEX_FIELD
)
4640 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
4642 if( field
== PREFIX_FIELD
)
4644 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << PREFIX_FIELD_TITLE
<< "</span></td>\n";
4646 if( field
== MINI_LEX_FIELD
)
4648 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << MINI_LEX_FIELD_TITLE
<< "</span></td>\n";
4650 if( field
== DESC_LENGTH_FIELD
)
4652 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
4654 if( field
== CORPUS_COUNT_FIELD
)
4656 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
4658 if( field
== STEM_COUNT_FIELD
)
4660 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
4663 line
= line
.mid( end
+ 1 );
4666 *out
<< "\t\t\t\t</tr>\n";
4670 alphabetized
.sort();
4672 // Output html file stuff
4674 for( QStringList::Iterator sIt
= alphabetized
.begin(); sIt
!= alphabetized
.end(); ++sIt
)
4676 pPrefixes
= ( *m_pLexicon
->GetAllPrefixes() )[ *sIt
];
4678 //for( pPrefix = pPrefixes->first(); pPrefix; pPrefix = pPrefixes->next() )
4679 for (int z
=0; z
< pPrefixes
->size(); z
++)
4680 { pPrefix
= pPrefixes
->at(z
);
4681 *out
<< "\t\t\t\t<tr>\n";
4685 line
= m_allPrefixesLine
->text();
4687 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4689 while( line
.length() > 0 )
4691 start
= line
.find( "%" );
4692 if( start
< 0 ) break;
4694 line
= line
.mid( start
);
4695 end
= line
.find( "%", 1 );
4696 field
= line
.mid( 0, end
+ 1 );
4698 if( field
== INDEX_FIELD
)
4700 *out
<< "\t\t\t\t\t<td";
4701 if( !m_allPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4702 *out
<< ">" << index
<< "</td>\n";
4704 if( field
== PREFIX_FIELD
)
4706 url
= m_projectName
->text() + QString( "_Mini_%1_Prefixes.html" ).arg( pPrefix
->GetMyMini()->GetIndex() + 1 );
4707 url
.replace( " ", "_" );
4708 *out
<< "\t\t\t\t\t<td";
4709 if( !m_allPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4710 *out
<< "><a name=\"_" + pPrefix
->Display() + "_\">" << getLParseText( pPrefix
, TRUE
, FALSE
, "suffix", url
) << "</a></td>\n";
4712 if( field
== MINI_LEX_FIELD
)
4714 *out
<< "\t\t\t\t\t<td";
4715 if( !m_allPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4716 *out
<< " align=\"center\">" << pPrefix
->GetMyMini()->GetIndex() + 1 << "</td>\n";
4718 if( field
== DESC_LENGTH_FIELD
)
4720 *out
<< "\t\t\t\t\t<td";
4721 if( !m_allPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4722 *out
<< ">" << pPrefix
->ComputeDL() << "</td>\n";
4724 if( field
== CORPUS_COUNT_FIELD
)
4726 *out
<< "\t\t\t\t\t<td";
4727 if( !m_allPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4728 *out
<< " align=\"center\">" << pPrefix
->GetCorpusCount() << "</td>\n";
4730 if( field
== STEM_COUNT_FIELD
)
4732 *out
<< "\t\t\t\t\t<td";
4733 if( !m_allPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
4734 *out
<< " align=\"center\">" << pPrefix
->GetStems()->count() << "</td>\n";
4737 line
= line
.mid( end
+ 1 );
4740 *out
<< "\t\t\t\t</tr>\n";
4742 if( m_allPrefixesIncludeStemListFlag
->isChecked() )
4744 *out
<< "\t\t\t\t<tr>\n";
4745 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_allPrefixesLine
->text().count( "%" ) / 2 ) << "\">\n";
4746 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
4747 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
4750 *out
<< "\t\t\t\t\t\t\t<tr>\n";
4751 //for( pStem = pPrefix->GetStems()->first(); pStem; pStem = pPrefix->GetStems()->next() )
4752 for (int z
= 0; z
< pPrefix
->GetStems()->size(); z
++)
4754 pStem
= pPrefix
->GetStems()->at(z
);
4755 if( count
> 0 && count
% 5 == 0 )
4757 *out
<< "\t\t\t\t\t\t\t</tr>\n";
4758 *out
<< "\t\t\t\t\t\t\t<tr>\n";
4761 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
) << "</td>\n";
4764 while( count
> 5 && count
% 5 != 0 )
4766 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
4770 *out
<< "\t\t\t\t\t\t\t</tr>\n";
4772 *out
<< "\t\t\t\t\t\t</table><br>\n";
4773 *out
<< "\t\t\t\t\t</td>\n";
4774 *out
<< "\t\t\t\t</tr>\n";
4777 if( index
% 20 == 0 )
4779 *out
<< "\t\t\t\t<tr>\n";
4780 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_allPrefixesLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
4781 *out
<< "\t\t\t\t</tr>\n";
4786 *out
<< "\t\t\t</table>\n";
4788 *out
<< getHTMLFooter();
4791 delete file
; file
= NULL
;
4792 delete out
; out
= NULL
;
4798 void ExportWizard::exportMiniWords()
4806 StringToString
* filter
= m_pLexicon
->GetOutFilter();
4808 QMap
<QString
,int> fieldWidths
;
4813 QString line
, field
, fileName
, url
, type
;
4815 CMiniLexicon
* pMini
;
4816 for( mini
= 0; mini
< m_pLexicon
->GetMiniSize(); mini
++ )
4818 pMini
= m_pLexicon
->GetMiniLexicon(mini
);
4819 if( !pMini
|| !pMini
->GetWords() ) continue;
4820 if( pMini
->GetWords()->GetCount() == 0 ) continue;
4822 fileName
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_WORDS_FILE_TITLE
;
4823 fileName
.replace( " ", "_" );
4825 // Write simple text file
4826 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
4828 file
= new QFile( fileName
+ ".txt" );
4829 if( file
->open( QIODevice::WriteOnly
) )
4831 fieldWidths
.clear();
4834 if( m_miniWordsUniformFieldWidthsFlag
->isChecked() )
4836 if( m_miniWordsColumnTitlesFlag
->isChecked() )
4838 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
4839 fieldWidths
[WORD_FIELD
] = WORD_FIELD_TITLE
.length();
4840 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
4841 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
4842 fieldWidths
[TYPE_FIELD
] = TYPE_FIELD_TITLE
.length();
4843 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
4844 fieldWidths
[SOURCE_FIELD
] = SOURCE_FIELD_TITLE
.length();
4845 fieldWidths
[PREFIX_FIELD
] = PREFIX_FIELD_TITLE
.length();
4846 fieldWidths
[STEM_FIELD
] = STEM_FIELD_TITLE
.length();
4847 fieldWidths
[SUFFIX_FIELD
] = SUFFIX_FIELD_TITLE
.length();
4850 pMini
->GetWords()->Sort(PARSE_SIZE
);
4851 for( i
= 0; i
< pMini
->GetWords()->GetCount(); i
++ )
4853 pWord
= pMini
->GetWords()->GetAtSort(i
);
4855 if( pWord
->Size() > 1 )
4857 pSig
= pWord
->GetSuffixSignature();
4858 if( pSig
== NULL
) pSig
= pWord
->GetPrefixSignature();
4862 if( m_miniWordsLine
->text().find( INDEX_FIELD
) >= 0 )
4864 width
= QString( "%1" ).arg( i
+ 1 ).length();
4865 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
4867 if( m_miniWordsLine
->text().find( WORD_FIELD
) >= 0 )
4869 width
= pWord
->Display( filter
).length();
4870 if( width
> fieldWidths
[WORD_FIELD
] ) fieldWidths
[WORD_FIELD
] = width
;
4872 if( m_miniWordsLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
4874 width
= QString( "%1" ).arg( pWord
->CalculateDL() ).length();
4875 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
4877 if( m_miniWordsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
4879 width
= QString( "%1" ).arg( pWord
->GetCorpusCount() ).length();
4880 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
4882 if( m_miniWordsLine
->text().find( TYPE_FIELD
) >= 0 )
4884 width
= pWord
->DisplayStemType().length();
4885 if( width
> fieldWidths
[TYPE_FIELD
] ) fieldWidths
[TYPE_FIELD
] = width
;
4887 if( m_miniWordsLine
->text().find( SIGNATURE_FIELD
) >= 0 )
4889 if( pSig
) width
= pSig
->Display( '.', filter
).length();
4891 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
4893 if( m_miniWordsLine
->text().find( SOURCE_FIELD
) >= 0 )
4895 if( pSig
) width
= pSig
->GetRemark().length();
4896 else width
= pWord
->GetConfidence().length();
4897 if( width
> fieldWidths
[SOURCE_FIELD
] ) fieldWidths
[SOURCE_FIELD
] = width
;
4899 if( m_miniWordsLine
->text().find( PREFIX_FIELD
) >= 0 )
4901 width
= pWord
->GetPiece( pWord
->GetPrefixLoc() ).Display( filter
).length();
4902 if( width
> fieldWidths
[PREFIX_FIELD
] ) fieldWidths
[PREFIX_FIELD
] = width
;
4904 if( m_miniWordsLine
->text().find( STEM_FIELD
) >= 0 )
4906 width
= pWord
->GetStem().Display( filter
).length();
4907 if( width
> fieldWidths
[STEM_FIELD
] ) fieldWidths
[STEM_FIELD
] = width
;
4909 if( m_miniWordsLine
->text().find( SUFFIX_FIELD
) >= 0 )
4911 width
= pWord
->GetPiece( pWord
->GetSuffixLoc() ).Display( filter
).length();
4912 if( width
> fieldWidths
[SUFFIX_FIELD
] ) fieldWidths
[SUFFIX_FIELD
] = width
;
4919 out
= new Q3TextStream( file
);
4920 out
->setEncoding( Q3TextStream::Unicode
);
4924 if( m_miniWordsColumnTitlesFlag
->isChecked() )
4928 line
= m_miniWordsLine
->text();
4930 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
4932 while( line
.length() > 0 )
4934 start
= line
.find( "%" );
4942 *out
<< line
.left( start
);
4943 line
= line
.mid( start
);
4944 end
= line
.find( "%", 1 );
4945 field
= line
.mid( 0, end
+ 1 );
4947 if( field
== INDEX_FIELD
)
4950 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
4951 *out
<< INDEX_FIELD_TITLE
;
4953 if( field
== WORD_FIELD
)
4956 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[WORD_FIELD
] );
4957 *out
<< WORD_FIELD_TITLE
;
4959 if( field
== CORPUS_COUNT_FIELD
)
4962 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
4963 *out
<< CORPUS_COUNT_FIELD_TITLE
;
4965 if( field
== DESC_LENGTH_FIELD
)
4968 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
4969 *out
<< DESC_LENGTH_FIELD_TITLE
;
4971 if( field
== TYPE_FIELD
)
4974 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
4975 *out
<< TYPE_FIELD_TITLE
;
4977 if( field
== SIGNATURE_FIELD
)
4980 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
4981 *out
<< SIGNATURE_FIELD_TITLE
;
4983 if( field
== SOURCE_FIELD
)
4986 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SOURCE_FIELD
] );
4987 *out
<< SOURCE_FIELD_TITLE
;
4989 if( field
== PREFIX_FIELD
)
4992 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
4993 *out
<< PREFIX_FIELD_TITLE
;
4995 if( field
== STEM_FIELD
)
4998 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
4999 *out
<< STEM_FIELD_TITLE
;
5001 if( field
== SUFFIX_FIELD
)
5004 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
5005 *out
<< SUFFIX_FIELD_TITLE
;
5008 line
= line
.mid( end
+ 1 );
5014 // Sort appropriately
5015 if( m_miniWordsMorphemeCountSortFlag
->isChecked() ) pMini
->GetWords()->Sort(PARSE_SIZE
);
5016 else if( m_miniWordsCorpusCountSortFlag
->isChecked() ) pMini
->GetWords()->Sort(CORPUSCOUNT
);
5017 else pMini
->GetWords()->Sort(KEY
);
5019 // Output text file stuff
5021 for( i
= 0; i
< pMini
->GetWords()->GetCount(); i
++ )
5023 pWord
= pMini
->GetWords()->GetAtSort(i
);
5025 if( pWord
->Size() > 1 )
5027 pSig
= pWord
->GetSuffixSignature();
5028 if( pSig
== NULL
) pSig
= pWord
->GetPrefixSignature();
5032 if( m_miniWordsAnalyzedOnlyFlag
->isChecked() && pWord
->Size() < 2 ) continue;
5034 if( m_miniWordsColumnTitlesFlag
->isChecked() ) *out
<< " ";
5036 line
= m_miniWordsLine
->text();
5038 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5040 while( line
.length() > 0 )
5042 start
= line
.find( "%" );
5050 *out
<< line
.left( start
);
5051 line
= line
.mid( start
);
5052 end
= line
.find( "%", 1 );
5053 field
= line
.mid( 0, end
+ 1 );
5055 if( field
== INDEX_FIELD
)
5058 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
5061 if( field
== WORD_FIELD
)
5064 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[WORD_FIELD
] );
5065 *out
<< pWord
->Display( filter
);
5067 if( field
== CORPUS_COUNT_FIELD
)
5070 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
5071 *out
<< pWord
->GetCorpusCount();
5073 if( field
== DESC_LENGTH_FIELD
)
5076 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
5077 *out
<< pWord
->CalculateDL();
5079 if( field
== TYPE_FIELD
)
5082 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
5083 *out
<< pWord
->DisplayStemType();
5085 if( field
== SIGNATURE_FIELD
)
5088 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
5089 if( pSig
) *out
<< getLParseText( pSig
);
5092 if( field
== SOURCE_FIELD
)
5095 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SOURCE_FIELD
] );
5096 if( pSig
) *out
<< pSig
->GetRemark();
5097 else *out
<< pWord
->GetConfidence();
5099 if( field
== PREFIX_FIELD
)
5102 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
5103 *out
<< pWord
->GetPiece( pWord
->GetPrefixLoc() ).Display( filter
);
5105 if( field
== STEM_FIELD
)
5108 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
5109 *out
<< pWord
->GetStem().Display( filter
);
5111 if( field
== SUFFIX_FIELD
)
5114 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
5115 *out
<< pWord
->GetPiece( pWord
->GetSuffixLoc() ).Display( filter
);
5118 line
= line
.mid( end
+ 1 );
5125 delete file
; file
= NULL
;
5126 delete out
; out
= NULL
;
5130 // Write mark-up file
5131 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
5133 file
= new QFile( fileName
+ ".html" );
5134 if( file
->open( QIODevice::WriteOnly
) )
5136 out
= new Q3TextStream( file
);
5137 out
->setEncoding( Q3TextStream::Unicode
);
5139 // Output html file stuff
5140 *out
<< getHTMLHeader( m_projectName
->text(), MINI_WORDS_FILE_TITLE
, m_language
->text(), m_researchers
->text(), pMini
->GetIndex() );
5142 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
5145 if( m_miniWordsColumnTitlesFlag
->isChecked() )
5147 *out
<< "\t\t\t\t<tr>\n";
5149 line
= m_miniWordsLine
->text();
5151 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5153 while( line
.length() > 0 )
5155 start
= line
.find( "%" );
5157 if( start
< 0 ) break;
5159 line
= line
.mid( start
);
5160 end
= line
.find( "%", 1 );
5161 field
= line
.mid( 0, end
+ 1 );
5163 if( field
== INDEX_FIELD
)
5165 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
5167 if( field
== WORD_FIELD
)
5169 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << WORD_FIELD_TITLE
<< "</span></td>\n";
5171 if( field
== CORPUS_COUNT_FIELD
)
5173 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
5175 if( field
== DESC_LENGTH_FIELD
)
5177 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
5179 if( field
== TYPE_FIELD
)
5181 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << TYPE_FIELD_TITLE
<< "</span></td>\n";
5183 if( field
== SIGNATURE_FIELD
)
5185 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
5187 if( field
== SOURCE_FIELD
)
5189 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SOURCE_FIELD_TITLE
<< "</span></td>\n";
5191 if( field
== PREFIX_FIELD
)
5193 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << PREFIX_FIELD_TITLE
<< "</span></td>\n";
5195 if( field
== STEM_FIELD
)
5197 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << STEM_FIELD_TITLE
<< "</span></td>\n";
5199 if( field
== SUFFIX_FIELD
)
5201 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SUFFIX_FIELD_TITLE
<< "</span></td>\n";
5204 line
= line
.mid( end
+ 1 );
5207 *out
<< "\t\t\t\t</tr>\n";
5211 // Sort appropriately
5212 if( m_miniWordsMorphemeCountSortFlag
->isChecked() ) pMini
->GetWords()->Sort(PARSE_SIZE
);
5213 else if( m_miniWordsCorpusCountSortFlag
->isChecked() ) pMini
->GetWords()->Sort(CORPUSCOUNT
);
5214 else pMini
->GetWords()->Sort(KEY
);
5217 // Output html file stuff
5219 for( i
= 0; i
< pMini
->GetWords()->GetCount(); i
++ )
5221 pWord
= pMini
->GetWords()->GetAtSort(i
);
5223 if( pWord
->Size() > 1 )
5225 pSig
= pWord
->GetSuffixSignature();
5226 if( pSig
== NULL
) pSig
= pWord
->GetPrefixSignature();
5230 if( m_miniWordsAnalyzedOnlyFlag
->isChecked() && pWord
->Size() < 2 ) continue;
5232 *out
<< "\t\t\t\t<tr>\n";
5234 line
= m_miniWordsLine
->text();
5236 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5238 while( line
.length() > 0 )
5240 start
= line
.find( "%" );
5241 if( start
< 0 ) break;
5243 line
= line
.mid( start
);
5244 end
= line
.find( "%", 1 );
5245 field
= line
.mid( 0, end
+ 1 );
5247 if( field
== INDEX_FIELD
)
5249 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << index
++ << "</td>\n";
5251 if( field
== WORD_FIELD
)
5253 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"><a name=\"_" << pWord
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pWord
, TRUE
, TRUE
, "word" ) << "</a></td>\n";
5255 if( field
== CORPUS_COUNT_FIELD
)
5257 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << pWord
->GetCorpusCount() << "</td>\n";
5259 if( field
== DESC_LENGTH_FIELD
)
5261 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pWord
->CalculateDL() << "</td>\n";
5263 if( field
== TYPE_FIELD
)
5265 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pWord
->DisplayStemType() << "</td>\n";
5267 if( field
== SIGNATURE_FIELD
)
5269 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_SIGNATURES_FILE_TITLE
+ ".html";
5270 url
.replace( " ", "_" );
5272 if( pSig
) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pSig
, TRUE
, FALSE
, type
, url
) << "</td>\n";
5273 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
5275 if( field
== SOURCE_FIELD
)
5277 if( pSig
) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pSig
->GetRemark() << "</td>\n";
5278 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pWord
->GetConfidence() << "</td>\n";
5280 if( field
== PREFIX_FIELD
)
5282 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_PREFIXES_FILE_TITLE
+ ".html";
5283 url
.replace( " ", "_" );
5285 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
->GetPrefixPtr(), TRUE
, FALSE
, type
, url
) << "</td>\n";
5287 if( field
== STEM_FIELD
)
5289 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_STEMS_FILE_TITLE
+ ".html";
5290 url
.replace( " ", "_" );
5292 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
->GetStemPtr(), TRUE
, FALSE
, type
, url
) << "</td>\n";
5294 if( field
== SUFFIX_FIELD
)
5296 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_SUFFIXES_FILE_TITLE
+ ".html";
5297 url
.replace( " ", "_" );
5299 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pWord
->GetSuffixPtr(), TRUE
, FALSE
, type
, url
) << "</td>\n";
5302 line
= line
.mid( end
+ 1 );
5305 *out
<< "\t\t\t\t</tr>\n";
5307 if( index
% 20 == 0 )
5309 *out
<< "\t\t\t\t<tr>\n";
5310 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_miniWordsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
5311 *out
<< "\t\t\t\t</tr>\n";
5315 *out
<< "\t\t\t</table>\n";
5317 *out
<< getHTMLFooter();
5320 delete file
; file
= NULL
;
5321 delete out
; out
= NULL
;
5328 void ExportWizard::exportMiniSignatures()
5336 StringToString
* filter
= m_pLexicon
->GetOutFilter();
5338 QMap
<QString
,int> fieldWidths
;
5344 QString line
, field
, fileName
, url
, type
= "stem";
5346 CMiniLexicon
* pMini
;
5347 for( mini
= 0; mini
< m_pLexicon
->GetMiniSize(); mini
++ )
5349 pMini
= m_pLexicon
->GetMiniLexicon(mini
);
5350 if( !pMini
|| !pMini
->GetSignatures() ) continue;
5351 if( pMini
->GetSignatures()->GetCount() == 0 ) continue;
5353 fileName
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_SIGNATURES_FILE_TITLE
;
5354 fileName
.replace( " ", "_" );
5356 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_STEMS_FILE_TITLE
+ ".html";
5357 url
.replace( " ", "_" );
5359 // Write simple text file
5360 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
5362 file
= new QFile( fileName
+ ".txt" );
5363 if( file
->open( QIODevice::WriteOnly
) )
5365 fieldWidths
.clear();
5368 if( m_miniSignaturesUniformFieldWidthsFlag
->isChecked() )
5370 if( m_miniSignaturesColumnTitlesFlag
->isChecked() )
5372 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
5373 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
5374 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
5375 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
5376 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
5377 fieldWidths
[EXEMPLAR_FIELD
] = EXEMPLAR_FIELD_TITLE
.length();
5378 fieldWidths
[REMARKS_FIELD
] = REMARKS_FIELD_TITLE
.length();
5379 fieldWidths
[ROBUSTNESS_FIELD
] = ROBUSTNESS_FIELD_TITLE
.length();
5380 if( m_miniSignaturesIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
5383 pMini
->GetSignatures()->Sort(PARSE_SIZE
);
5384 for( i
= 0; i
< pMini
->GetSignatures()->GetCount(); i
++ )
5386 pSig
= pMini
->GetSignatures()->GetAtSort(i
);
5388 if( m_miniSignaturesLine
->text().find( INDEX_FIELD
) >= 0 )
5390 width
= QString( "%1" ).arg(i
).length();
5391 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
5393 if( m_miniSignaturesLine
->text().find( SIGNATURE_FIELD
) >= 0 )
5395 width
= pSig
->Display( '.', filter
).length();
5396 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
5398 if( m_miniSignaturesLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
5400 width
= QString( "%1" ).arg( pSig
->ComputeDLofModel() ).length();
5401 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
5403 if( m_miniSignaturesLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
5405 width
= QString( "%1" ).arg( pSig
->GetCorpusCount() ).length();
5406 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
5408 if( m_miniSignaturesLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
5410 width
= QString( "%1" ).arg( pSig
->GetNumberOfStems() ).length();
5411 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
5413 if( m_miniSignaturesLine
->text().find( EXEMPLAR_FIELD
) >= 0 )
5415 width
= pSig
->GetStem(0)->Display( filter
).length();
5416 if( width
> fieldWidths
[EXEMPLAR_FIELD
] ) fieldWidths
[EXEMPLAR_FIELD
] = width
;
5418 if( m_miniSignaturesLine
->text().find( REMARKS_FIELD
) >= 0 )
5420 width
= pSig
->GetRemark().length();
5421 if( width
> fieldWidths
[REMARKS_FIELD
] ) fieldWidths
[REMARKS_FIELD
] = width
;
5423 if( m_miniSignaturesLine
->text().find( ROBUSTNESS_FIELD
) >= 0 )
5425 width
= QString( "%1" ).arg( pSig
->GetRobustness() ).length();
5426 if( width
> fieldWidths
[ROBUSTNESS_FIELD
] ) fieldWidths
[ROBUSTNESS_FIELD
] = width
;
5429 if( m_miniSignaturesIncludeStemListFlag
->isChecked() )
5432 //for( pStem = pSig->GetStem(0); pStem; pStem = pSig->GetStemPtrList()->next() )
5433 for (int z
= 0; z
< pSig
->GetNumberOfStems(); z
++)
5434 { pStem
= pSig
->GetStem(z
);
5435 if( width
< static_cast <int> (pStem
->Display( filter
).length()) ) width
= static_cast <int> (pStem
->Display( filter
).length());
5437 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
5444 out
= new Q3TextStream( file
);
5445 out
->setEncoding( Q3TextStream::Unicode
);
5449 if( m_miniSignaturesColumnTitlesFlag
->isChecked() )
5453 line
= m_miniSignaturesLine
->text();
5455 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5457 while( line
.length() > 0 )
5459 start
= line
.find( "%" );
5467 *out
<< line
.left( start
);
5468 line
= line
.mid( start
);
5469 end
= line
.find( "%", 1 );
5470 field
= line
.mid( 0, end
+ 1 );
5472 if( field
== INDEX_FIELD
)
5475 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
5476 *out
<< INDEX_FIELD_TITLE
;
5478 if( field
== SIGNATURE_FIELD
)
5481 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
5482 *out
<< SIGNATURE_FIELD_TITLE
;
5484 if( field
== DESC_LENGTH_FIELD
)
5487 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
5488 *out
<< DESC_LENGTH_FIELD_TITLE
;
5490 if( field
== CORPUS_COUNT_FIELD
)
5493 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
5494 *out
<< CORPUS_COUNT_FIELD_TITLE
;
5496 if( field
== STEM_COUNT_FIELD
)
5499 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
5500 *out
<< STEM_COUNT_FIELD_TITLE
;
5502 if( field
== EXEMPLAR_FIELD
)
5505 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[EXEMPLAR_FIELD
] );
5506 *out
<< EXEMPLAR_FIELD_TITLE
;
5508 if( field
== REMARKS_FIELD
)
5511 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[REMARKS_FIELD
] );
5512 *out
<< REMARKS_FIELD_TITLE
;
5514 if( field
== ROBUSTNESS_FIELD
)
5517 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ROBUSTNESS_FIELD
] );
5518 *out
<< ROBUSTNESS_FIELD_TITLE
;
5521 line
= line
.mid( end
+ 1 );
5527 // Sort appropriately
5528 if( m_miniSignaturesStemCountSortFlag
->isChecked() ) pMini
->GetSignatures()->Sort(SIGS_NUMBER_OF_STEMS
);
5529 else if( m_miniSignaturesCorpusCountSortFlag
->isChecked() ) pMini
->GetSignatures()->Sort(CORPUSCOUNT
);
5530 else pMini
->GetSignatures()->Sort(KEY
);
5532 // Output text file stuff
5534 for( i
= 0; i
< pMini
->GetSignatures()->GetCount(); i
++ )
5536 pSig
= pMini
->GetSignatures()->GetAtSort(i
);
5538 if( m_miniSignaturesColumnTitlesFlag
->isChecked() ) *out
<< " ";
5540 line
= m_miniSignaturesLine
->text();
5542 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5544 while( line
.length() > 0 )
5546 start
= line
.find( "%" );
5554 *out
<< line
.left( start
);
5555 line
= line
.mid( start
);
5556 end
= line
.find( "%", 1 );
5557 field
= line
.mid( 0, end
+ 1 );
5559 if( field
== INDEX_FIELD
)
5562 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
5565 if( field
== SIGNATURE_FIELD
)
5568 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
5569 *out
<< pSig
->Display( '.', filter
);
5571 if( field
== DESC_LENGTH_FIELD
)
5574 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
5575 *out
<< pSig
->ComputeDLofModel();
5577 if( field
== STEM_COUNT_FIELD
)
5580 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
5581 *out
<< pSig
->GetNumberOfStems();
5583 if( field
== CORPUS_COUNT_FIELD
)
5586 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
5587 *out
<< pSig
->GetCorpusCount();
5589 if( field
== EXEMPLAR_FIELD
)
5592 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[EXEMPLAR_FIELD
] );
5593 *out
<< pSig
->GetStem(0)->Display( filter
);
5595 if( field
== REMARKS_FIELD
)
5598 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[REMARKS_FIELD
] );
5599 *out
<< pSig
->GetRemark();
5601 if( field
== ROBUSTNESS_FIELD
)
5604 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ROBUSTNESS_FIELD
] );
5605 *out
<< pSig
->GetRobustness();
5608 line
= line
.mid( end
+ 1 );
5613 if( m_miniSignaturesIncludeStemListFlag
->isChecked() )
5618 if( m_miniSignaturesColumnTitlesFlag
->isChecked() )
5620 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
5621 *out
<< "# -------------------------------------------\n";
5623 //for( pStem = pSig->GetStem(0); pStem; pStem = pSig->GetStemPtrList()->next() )
5624 for (int z
= 0; z
< pSig
->GetNumberOfStems(); z
++)
5625 { pStem
= pSig
->GetStem(z
);
5626 if( count
% 5 == 0 )
5630 if( m_miniSignaturesColumnTitlesFlag
->isChecked() ) *out
<< " ";
5634 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
5635 *out
<< pStem
->Display( filter
);
5644 delete file
; file
= NULL
;
5645 delete out
; out
= NULL
;
5649 // Write mark-up file
5650 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
5652 file
= new QFile( fileName
+ ".html" );
5653 if( file
->open( QIODevice::WriteOnly
) )
5655 out
= new Q3TextStream( file
);
5656 out
->setEncoding( Q3TextStream::Unicode
);
5658 // Output html file stuff
5659 *out
<< getHTMLHeader( m_projectName
->text(), MINI_SIGNATURES_FILE_TITLE
, m_language
->text(), m_researchers
->text(), pMini
->GetIndex() );
5661 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
5664 if( m_miniSignaturesColumnTitlesFlag
->isChecked() )
5666 *out
<< "\t\t\t\t<tr>\n";
5668 line
= m_miniSignaturesLine
->text();
5670 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5672 while( line
.length() > 0 )
5674 start
= line
.find( "%" );
5676 if( start
< 0 ) break;
5678 line
= line
.mid( start
);
5679 end
= line
.find( "%", 1 );
5680 field
= line
.mid( 0, end
+ 1 );
5682 if( field
== INDEX_FIELD
)
5684 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
5686 if( field
== SIGNATURE_FIELD
)
5688 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
5690 if( field
== CORPUS_COUNT_FIELD
)
5692 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
5694 if( field
== DESC_LENGTH_FIELD
)
5696 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
5698 if( field
== STEM_COUNT_FIELD
)
5700 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
5702 if( field
== EXEMPLAR_FIELD
)
5704 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << EXEMPLAR_FIELD_TITLE
<< "</span></td>\n";
5706 if( field
== REMARKS_FIELD
)
5708 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << REMARKS_FIELD_TITLE
<< "</span></td>\n";
5710 if( field
== ROBUSTNESS_FIELD
)
5712 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << ROBUSTNESS_FIELD_TITLE
<< "</span></td>\n";
5715 line
= line
.mid( end
+ 1 );
5718 *out
<< "\t\t\t\t</tr>\n";
5722 // Sort appropriately
5723 if( m_miniSignaturesStemCountSortFlag
->isChecked() ) pMini
->GetSignatures()->Sort(SIGS_NUMBER_OF_STEMS
);
5724 else if( m_miniSignaturesCorpusCountSortFlag
->isChecked() ) pMini
->GetSignatures()->Sort(CORPUSCOUNT
);
5725 else pMini
->GetSignatures()->Sort(KEY
);
5728 // Output html file stuff
5730 for( i
= 0; i
< pMini
->GetSignatures()->GetCount(); i
++ )
5732 pSig
= pMini
->GetSignatures()->GetAtSort(i
);
5734 *out
<< "\t\t\t\t<tr>\n";
5736 line
= m_miniSignaturesLine
->text();
5738 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5740 while( line
.length() > 0 )
5742 start
= line
.find( "%" );
5743 if( start
< 0 ) break;
5745 line
= line
.mid( start
);
5746 end
= line
.find( "%", 1 );
5747 field
= line
.mid( 0, end
+ 1 );
5749 if( field
== INDEX_FIELD
)
5751 *out
<< "\t\t\t\t\t<td";
5752 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5753 *out
<< ">" << index
++ << "</td>\n";
5755 if( field
== SIGNATURE_FIELD
)
5757 *out
<< "\t\t\t\t\t<td";
5758 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5759 *out
<< "><a name=\"_" << pSig
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pSig
, TRUE
, TRUE
, "signature" ) << "</a></td>\n";
5761 if( field
== DESC_LENGTH_FIELD
)
5763 *out
<< "\t\t\t\t\t<td";
5764 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5765 *out
<< ">" << pSig
->ComputeDLofModel() << "</td>\n";
5767 if( field
== STEM_COUNT_FIELD
)
5769 *out
<< "\t\t\t\t\t<td";
5770 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5771 *out
<< " align=\"center\">" << pSig
->GetNumberOfStems() << "</td>\n";
5773 if( field
== CORPUS_COUNT_FIELD
)
5775 *out
<< "\t\t\t\t\t<td";
5776 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5777 *out
<< " align=\"center\">" << pSig
->GetCorpusCount() << "</td>\n";
5779 if( field
== EXEMPLAR_FIELD
)
5781 *out
<< "\t\t\t\t\t<td";
5782 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5783 *out
<< ">" << getLParseText( pSig
->GetStem(0), TRUE
, FALSE
, type
, url
) << "</td>\n";
5785 if( field
== REMARKS_FIELD
)
5787 *out
<< "\t\t\t\t\t<td";
5788 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5789 *out
<< ">" << pSig
->GetRemark() << "</td>\n";
5791 if( field
== ROBUSTNESS_FIELD
)
5793 *out
<< "\t\t\t\t\t<td";
5794 if( !m_miniSignaturesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
5795 *out
<< " align=\"center\">" << pSig
->GetRobustness() << "</td>\n";
5798 line
= line
.mid( end
+ 1 );
5801 *out
<< "\t\t\t\t</tr>\n";
5803 if( m_miniSignaturesIncludeStemListFlag
->isChecked() )
5805 *out
<< "\t\t\t\t<tr>\n";
5806 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_miniSignaturesLine
->text().count( "%" ) / 2 ) << "\">\n";
5807 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
5808 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
5811 *out
<< "\t\t\t\t\t\t\t<tr>\n";
5812 //for( pStem = pSig->GetStem(0); pStem; pStem = pSig->GetStemPtrList()->next() )
5813 for (int z
= 0; z
< pSig
->GetNumberOfStems();z
++)
5814 { pStem
= pSig
->GetStem(z
);
5815 if( count
> 0 && count
% 5 == 0 )
5817 *out
<< "\t\t\t\t\t\t\t</tr>\n";
5818 *out
<< "\t\t\t\t\t\t\t<tr>\n";
5821 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
, type
, url
) << "</td>\n";
5824 while( count
> 5 && count
% 5 != 0 )
5826 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
5830 *out
<< "\t\t\t\t\t\t\t</tr>\n";
5832 *out
<< "\t\t\t\t\t\t</table><br>\n";
5833 *out
<< "\t\t\t\t\t</td>\n";
5834 *out
<< "\t\t\t\t</tr>\n";
5837 if( index
% 20 == 0 )
5839 *out
<< "\t\t\t\t<tr>\n";
5840 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_miniSignaturesLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
5841 *out
<< "\t\t\t\t</tr>\n";
5845 *out
<< "\t\t\t</table>\n";
5847 *out
<< getHTMLFooter();
5850 delete file
; file
= NULL
;
5851 delete out
; out
= NULL
;
5858 void ExportWizard::exportMiniStems()
5866 StringToString
* filter
= m_pLexicon
->GetOutFilter();
5868 QMap
<QString
,int> fieldWidths
;
5873 QString line
, field
, fileName
, url
, type
;
5875 CMiniLexicon
* pMini
;
5876 for( mini
= 0; mini
< m_pLexicon
->GetMiniSize(); mini
++ )
5878 pMini
= m_pLexicon
->GetMiniLexicon(mini
);
5879 if( !pMini
|| !pMini
->GetStems() ) continue;
5880 if( pMini
->GetStems()->GetCount() == 0 ) continue;
5882 fileName
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_STEMS_FILE_TITLE
;
5883 fileName
.replace( " ", "_" );
5885 // Write simple text file
5886 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
5888 file
= new QFile( fileName
+ ".txt" );
5889 if( file
->open( QIODevice::WriteOnly
) )
5891 fieldWidths
.clear();
5894 if( m_miniStemsUniformFieldWidthsFlag
->isChecked() )
5896 if( m_miniStemsColumnTitlesFlag
->isChecked() )
5898 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
5899 fieldWidths
[STEM_FIELD
] = STEM_FIELD_TITLE
.length();
5900 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
5901 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
5902 fieldWidths
[TYPE_FIELD
] = TYPE_FIELD_TITLE
.length();
5903 fieldWidths
[SIGNATURE_FIELD
] = SIGNATURE_FIELD_TITLE
.length();
5904 fieldWidths
[ORIGIN_FIELD
] = ORIGIN_FIELD_TITLE
.length();
5907 pMini
->GetStems()->Sort(PARSE_SIZE
);
5908 for( i
= 0; i
< pMini
->GetStems()->GetCount(); i
++ )
5910 pStem
= pMini
->GetStems()->GetAtSort(i
);
5912 pSig
= pStem
->GetSuffixSignature();
5913 if( pSig
== NULL
) pSig
= pStem
->GetPrefixSignature();
5915 if( m_miniStemsLine
->text().find( INDEX_FIELD
) >= 0 )
5917 width
= QString( "%1" ).arg( i
+ 1 ).length();
5918 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
5920 if( m_miniStemsLine
->text().find( STEM_FIELD
) >= 0 )
5922 width
= pStem
->Display( filter
).length();
5923 if( width
> fieldWidths
[STEM_FIELD
] ) fieldWidths
[STEM_FIELD
] = width
;
5925 if( m_miniStemsLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
5927 width
= QString( "%1" ).arg( pStem
->CalculateDL() ).length();
5928 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
5930 if( m_miniStemsLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
5932 width
= QString( "%1" ).arg( pStem
->GetCorpusCount() ).length();
5933 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
5935 if( m_miniStemsLine
->text().find( TYPE_FIELD
) >= 0 )
5937 width
= pStem
->DisplayStemType().length();
5938 if( width
> fieldWidths
[TYPE_FIELD
] ) fieldWidths
[TYPE_FIELD
] = width
;
5940 if( m_miniStemsLine
->text().find( SIGNATURE_FIELD
) >= 0 )
5942 if( pSig
) width
= pSig
->Display( '.', filter
).length();
5944 if( width
> fieldWidths
[SIGNATURE_FIELD
] ) fieldWidths
[SIGNATURE_FIELD
] = width
;
5946 if( m_miniStemsLine
->text().find( ORIGIN_FIELD
) >= 0 )
5948 if( pSig
) width
= pSig
->GetRemark().length();
5949 else width
= pStem
->GetConfidence().length();
5950 if( width
> fieldWidths
[ORIGIN_FIELD
] ) fieldWidths
[ORIGIN_FIELD
] = width
;
5957 out
= new Q3TextStream( file
);
5958 out
->setEncoding( Q3TextStream::Unicode
);
5962 if( m_miniStemsColumnTitlesFlag
->isChecked() )
5966 line
= m_miniStemsLine
->text();
5968 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
5970 while( line
.length() > 0 )
5972 start
= line
.find( "%" );
5980 *out
<< line
.left( start
);
5981 line
= line
.mid( start
);
5982 end
= line
.find( "%", 1 );
5983 field
= line
.mid( 0, end
+ 1 );
5985 if( field
== INDEX_FIELD
)
5988 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
5989 *out
<< INDEX_FIELD_TITLE
;
5991 if( field
== STEM_FIELD
)
5994 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
5995 *out
<< STEM_FIELD_TITLE
;
5997 if( field
== CORPUS_COUNT_FIELD
)
6000 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
6001 *out
<< CORPUS_COUNT_FIELD_TITLE
;
6003 if( field
== DESC_LENGTH_FIELD
)
6006 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
6007 *out
<< DESC_LENGTH_FIELD_TITLE
;
6009 if( field
== TYPE_FIELD
)
6012 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
6013 *out
<< TYPE_FIELD_TITLE
;
6015 if( field
== SIGNATURE_FIELD
)
6018 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
6019 *out
<< SIGNATURE_FIELD_TITLE
;
6021 if( field
== ORIGIN_FIELD
)
6024 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[ORIGIN_FIELD
] );
6025 *out
<< ORIGIN_FIELD_TITLE
;
6028 line
= line
.mid( end
+ 1 );
6034 // Sort appropriately
6035 if( m_miniStemsCorpusCountSortFlag
->isChecked() ) pMini
->GetStems()->Sort(CORPUSCOUNT
);
6036 else pMini
->GetStems()->Sort(KEY
);
6038 // Output text file stuff
6040 for( i
= 0; i
< pMini
->GetStems()->GetCount(); i
++ )
6042 pStem
= pMini
->GetStems()->GetAtSort(i
);
6044 pSig
= pStem
->GetSuffixSignature();
6045 if( pSig
== NULL
) pSig
= pStem
->GetPrefixSignature();
6047 if( m_miniStemsColumnTitlesFlag
->isChecked() ) *out
<< " ";
6049 line
= m_miniStemsLine
->text();
6051 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6053 while( line
.length() > 0 )
6055 start
= line
.find( "%" );
6063 *out
<< line
.left( start
);
6064 line
= line
.mid( start
);
6065 end
= line
.find( "%", 1 );
6066 field
= line
.mid( 0, end
+ 1 );
6068 if( field
== INDEX_FIELD
)
6071 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
6074 if( field
== STEM_FIELD
)
6077 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_FIELD
] );
6078 *out
<< pStem
->Display( filter
);
6080 if( field
== CORPUS_COUNT_FIELD
)
6083 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
6084 *out
<< pStem
->GetCorpusCount();
6086 if( field
== DESC_LENGTH_FIELD
)
6089 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
6090 *out
<< pStem
->CalculateDL();
6092 if( field
== TYPE_FIELD
)
6095 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[TYPE_FIELD
] );
6096 *out
<< pStem
->DisplayStemType();
6098 if( field
== SIGNATURE_FIELD
)
6101 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SIGNATURE_FIELD
] );
6102 if( pSig
) *out
<< getLParseText( pSig
);
6105 if( field
== ORIGIN_FIELD
)
6108 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SOURCE_FIELD
] );
6109 /* if( pSig ) *out << pSig->GetRemark();
6110 else*/ *out
<< pStem
->GetConfidence();
6113 line
= line
.mid( end
+ 1 );
6120 delete file
; file
= NULL
;
6121 delete out
; out
= NULL
;
6125 // Write mark-up file
6126 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
6128 file
= new QFile( fileName
+ ".html" );
6129 if( file
->open( QIODevice::WriteOnly
) )
6131 out
= new Q3TextStream( file
);
6132 out
->setEncoding( Q3TextStream::Unicode
);
6134 // Output html file stuff
6135 *out
<< getHTMLHeader( m_projectName
->text(), MINI_STEMS_FILE_TITLE
, m_language
->text(), m_researchers
->text(), pMini
->GetIndex() );
6137 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
6140 if( m_miniStemsColumnTitlesFlag
->isChecked() )
6142 *out
<< "\t\t\t\t<tr>\n";
6144 line
= m_miniStemsLine
->text();
6146 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6148 while( line
.length() > 0 )
6150 start
= line
.find( "%" );
6152 if( start
< 0 ) break;
6154 line
= line
.mid( start
);
6155 end
= line
.find( "%", 1 );
6156 field
= line
.mid( 0, end
+ 1 );
6158 if( field
== INDEX_FIELD
)
6160 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
6162 if( field
== STEM_FIELD
)
6164 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << STEM_FIELD_TITLE
<< "</span></td>\n";
6166 if( field
== CORPUS_COUNT_FIELD
)
6168 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
6170 if( field
== DESC_LENGTH_FIELD
)
6172 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
6174 if( field
== TYPE_FIELD
)
6176 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << TYPE_FIELD_TITLE
<< "</span></td>\n";
6178 if( field
== SIGNATURE_FIELD
)
6180 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SIGNATURE_FIELD_TITLE
<< "</span></td>\n";
6182 if( field
== ORIGIN_FIELD
)
6184 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << ORIGIN_FIELD_TITLE
<< "</span></td>\n";
6187 line
= line
.mid( end
+ 1 );
6190 *out
<< "\t\t\t\t</tr>\n";
6194 // Sort appropriately
6195 if( m_miniStemsCorpusCountSortFlag
->isChecked() ) pMini
->GetStems()->Sort(CORPUSCOUNT
);
6196 else pMini
->GetStems()->Sort(KEY
);
6199 // Output html file stuff
6201 for( i
= 0; i
< pMini
->GetStems()->GetCount(); i
++ )
6203 pStem
= pMini
->GetStems()->GetAtSort(i
);
6205 pSig
= pStem
->GetSuffixSignature();
6206 if( pSig
== NULL
) pSig
= pStem
->GetPrefixSignature();
6208 *out
<< "\t\t\t\t<tr>\n";
6210 line
= m_miniStemsLine
->text();
6212 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6214 while( line
.length() > 0 )
6216 start
= line
.find( "%" );
6217 if( start
< 0 ) break;
6219 line
= line
.mid( start
);
6220 end
= line
.find( "%", 1 );
6221 field
= line
.mid( 0, end
+ 1 );
6223 if( field
== INDEX_FIELD
)
6225 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << index
++ << "</td>\n";
6227 if( field
== STEM_FIELD
)
6229 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"><a name=\"_" << pStem
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pStem
, TRUE
, TRUE
) << "</a></td>\n";
6231 if( field
== CORPUS_COUNT_FIELD
)
6233 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" align=\"center\">" << pStem
->GetCorpusCount() << "</td>\n";
6235 if( field
== DESC_LENGTH_FIELD
)
6237 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pStem
->CalculateDL() << "</td>\n";
6239 if( field
== TYPE_FIELD
)
6241 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pStem
->DisplayStemType() << "</td>\n";
6243 if( field
== SIGNATURE_FIELD
)
6245 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_SIGNATURES_FILE_TITLE
+ ".html";
6246 url
.replace( " ", "_" );
6248 if( pSig
) *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << getLParseText( pSig
, TRUE
, FALSE
, type
, url
) << "</td>\n";
6249 else *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\"> </td>\n";
6251 if( field
== ORIGIN_FIELD
)
6253 /* if( pSig ) *out << "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pSig->GetRemark() << "</td>\n";
6254 else*/ *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\">" << pStem
->GetConfidence() << "</td>\n";
6257 line
= line
.mid( end
+ 1 );
6260 *out
<< "\t\t\t\t</tr>\n";
6262 if( index
% 20 == 0 )
6264 *out
<< "\t\t\t\t<tr>\n";
6265 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_miniStemsLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
6266 *out
<< "\t\t\t\t</tr>\n";
6270 *out
<< "\t\t\t</table>\n";
6272 *out
<< getHTMLFooter();
6275 delete file
; file
= NULL
;
6276 delete out
; out
= NULL
;
6283 void ExportWizard::exportMiniSuffixes()
6291 StringToString
* filter
= m_pLexicon
->GetOutFilter();
6293 QMap
<QString
,int> fieldWidths
;
6299 QString line
, field
, fileName
, url
, type
= "stem";
6301 CMiniLexicon
* pMini
;
6302 for( mini
= 0; mini
< m_pLexicon
->GetMiniSize(); mini
++ )
6304 pMini
= m_pLexicon
->GetMiniLexicon(mini
);
6305 if( !pMini
|| !pMini
->GetSuffixes() ) continue;
6306 if( pMini
->GetSuffixes()->GetCount() == 0 ) continue;
6308 fileName
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_SUFFIXES_FILE_TITLE
;
6309 fileName
.replace( " ", "_" );
6311 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_STEMS_FILE_TITLE
+ ".html";
6312 url
.replace( " ", "_" );
6315 // Write simple text file
6316 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
6318 file
= new QFile( fileName
+ ".txt" );
6319 if( file
->open( QIODevice::WriteOnly
) )
6321 fieldWidths
.clear();
6324 if( m_miniSuffixesUniformFieldWidthsFlag
->isChecked() )
6326 if( m_miniSuffixesColumnTitlesFlag
->isChecked() )
6328 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
6329 fieldWidths
[SUFFIX_FIELD
] = SUFFIX_FIELD_TITLE
.length();
6330 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
6331 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
6332 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
6333 if( m_miniSuffixesIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
6336 pMini
->GetSuffixes()->Sort(PARSE_SIZE
);
6337 for( i
= 0; i
< pMini
->GetSuffixes()->GetCount(); i
++ )
6339 pSuffix
= pMini
->GetSuffixes()->GetAtSort(i
);
6341 if( m_miniSuffixesLine
->text().find( INDEX_FIELD
) >= 0 )
6343 width
= QString( "%1" ).arg( i
+ 1 ).length();
6344 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
6346 if( m_miniSuffixesLine
->text().find( SUFFIX_FIELD
) >= 0 )
6348 width
= pSuffix
->Display( filter
).length();
6349 if( width
> fieldWidths
[SUFFIX_FIELD
] ) fieldWidths
[SUFFIX_FIELD
] = width
;
6351 if( m_miniSuffixesLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
6353 width
= QString( "%1" ).arg( pSuffix
->ComputeDL() ).length();
6354 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
6356 if( m_miniSuffixesLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
6358 width
= QString( "%1" ).arg( pSuffix
->GetCorpusCount() ).length();
6359 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
6361 if( m_miniSuffixesLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
6363 width
= QString( "%1" ).arg( pSuffix
->GetUseCount() ).length();
6364 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
6366 if( m_miniSuffixesIncludeStemListFlag
->isChecked() )
6369 //for( pStem = pSuffix->GetStems()->first(); pStem; pStem = pSuffix->GetStems()->next() )
6370 for (int z
= 0; z
< pSuffix
->GetStems()->size(); z
++)
6371 { pStem
= pSuffix
->GetStems()->at(z
);
6372 if( width
< static_cast <int> (pStem
->Display( filter
).length()) ) width
= static_cast <int> (pStem
->Display( filter
).length());
6374 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
6381 out
= new Q3TextStream( file
);
6382 out
->setEncoding( Q3TextStream::Unicode
);
6386 if( m_miniSuffixesColumnTitlesFlag
->isChecked() )
6390 line
= m_miniSuffixesLine
->text();
6392 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6394 while( line
.length() > 0 )
6396 start
= line
.find( "%" );
6404 *out
<< line
.left( start
);
6405 line
= line
.mid( start
);
6406 end
= line
.find( "%", 1 );
6407 field
= line
.mid( 0, end
+ 1 );
6409 if( field
== INDEX_FIELD
)
6412 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
6413 *out
<< INDEX_FIELD_TITLE
;
6415 if( field
== SUFFIX_FIELD
)
6418 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
6419 *out
<< SUFFIX_FIELD_TITLE
;
6421 if( field
== CORPUS_COUNT_FIELD
)
6424 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
6425 *out
<< CORPUS_COUNT_FIELD_TITLE
;
6427 if( field
== STEM_COUNT_FIELD
)
6430 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
6431 *out
<< STEM_COUNT_FIELD_TITLE
;
6433 if( field
== DESC_LENGTH_FIELD
)
6436 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
6437 *out
<< DESC_LENGTH_FIELD_TITLE
;
6440 line
= line
.mid( end
+ 1 );
6446 // Sort appropriately
6447 if( m_miniSuffixesCorpusCountSortFlag
->isChecked() ) pMini
->GetSuffixes()->Sort(CORPUSCOUNT
);
6448 else pMini
->GetSuffixes()->Sort(KEY
);
6450 // Output text file stuff
6452 for( i
= 0; i
< pMini
->GetSuffixes()->GetCount(); i
++ )
6454 pSuffix
= pMini
->GetSuffixes()->GetAtSort(i
);
6456 if( m_miniSuffixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
6458 line
= m_miniSuffixesLine
->text();
6460 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6462 while( line
.length() > 0 )
6464 start
= line
.find( "%" );
6472 *out
<< line
.left( start
);
6473 line
= line
.mid( start
);
6474 end
= line
.find( "%", 1 );
6475 field
= line
.mid( 0, end
+ 1 );
6477 if( field
== INDEX_FIELD
)
6480 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
6483 if( field
== SUFFIX_FIELD
)
6486 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[SUFFIX_FIELD
] );
6487 *out
<< pSuffix
->Display( filter
);
6489 if( field
== CORPUS_COUNT_FIELD
)
6492 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
6493 *out
<< pSuffix
->GetCorpusCount();
6495 if( field
== DESC_LENGTH_FIELD
)
6498 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
6499 *out
<< pSuffix
->ComputeDL();
6501 if( field
== STEM_COUNT_FIELD
)
6504 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
6505 *out
<< pSuffix
->GetUseCount();
6508 line
= line
.mid( end
+ 1 );
6513 if( m_miniSuffixesIncludeStemListFlag
->isChecked() )
6516 if( m_miniSuffixesColumnTitlesFlag
->isChecked() )
6518 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
6519 *out
<< "# -------------------------------------------\n";
6521 //for( pStem = pSuffix->GetStems()->first(); pStem; pStem = pSuffix->GetStems()->next() )
6522 for (int z
= 0; z
< pSuffix
->GetStems()->size(); z
++)
6523 { pStem
= pSuffix
->GetStems()->at(z
);
6524 if( count
% 5 == 0 )
6528 if( m_miniSuffixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
6532 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
6533 *out
<< pStem
->Display( filter
);
6542 delete file
; file
= NULL
;
6543 delete out
; out
= NULL
;
6547 // Write mark-up file
6548 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
6550 file
= new QFile( fileName
+ ".html" );
6551 if( file
->open( QIODevice::WriteOnly
) )
6553 out
= new Q3TextStream( file
);
6554 out
->setEncoding( Q3TextStream::Unicode
);
6556 // Output html file stuff
6557 *out
<< getHTMLHeader( m_projectName
->text(), MINI_SUFFIXES_FILE_TITLE
, m_language
->text(), m_researchers
->text(), pMini
->GetIndex() );
6559 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
6562 if( m_miniSuffixesColumnTitlesFlag
->isChecked() )
6564 *out
<< "\t\t\t\t<tr>\n";
6566 line
= m_miniSuffixesLine
->text();
6568 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6570 while( line
.length() > 0 )
6572 start
= line
.find( "%" );
6574 if( start
< 0 ) break;
6576 line
= line
.mid( start
);
6577 end
= line
.find( "%", 1 );
6578 field
= line
.mid( 0, end
+ 1 );
6580 if( field
== INDEX_FIELD
)
6582 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
6584 if( field
== SUFFIX_FIELD
)
6586 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << SUFFIX_FIELD_TITLE
<< "</span></td>\n";
6588 if( field
== CORPUS_COUNT_FIELD
)
6590 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
6592 if( field
== STEM_COUNT_FIELD
)
6594 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
6596 if( field
== DESC_LENGTH_FIELD
)
6598 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
6601 line
= line
.mid( end
+ 1 );
6604 *out
<< "\t\t\t\t</tr>\n";
6608 // Sort appropriately
6609 if( m_miniSuffixesCorpusCountSortFlag
->isChecked() ) pMini
->GetSuffixes()->Sort(CORPUSCOUNT
);
6610 else pMini
->GetSuffixes()->Sort(KEY
);
6613 // Output html file stuff
6615 for( i
= 0; i
< pMini
->GetSuffixes()->GetCount(); i
++ )
6617 pSuffix
= pMini
->GetSuffixes()->GetAtSort(i
);
6619 *out
<< "\t\t\t\t<tr>\n";
6621 line
= m_miniSuffixesLine
->text();
6623 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6625 while( line
.length() > 0 )
6627 start
= line
.find( "%" );
6628 if( start
< 0 ) break;
6630 line
= line
.mid( start
);
6631 end
= line
.find( "%", 1 );
6632 field
= line
.mid( 0, end
+ 1 );
6634 if( field
== INDEX_FIELD
)
6636 *out
<< "\t\t\t\t\t<td";
6637 if( !m_miniSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
6638 *out
<< ">" << index
++ << "</td>\n";
6640 if( field
== SUFFIX_FIELD
)
6642 *out
<< "\t\t\t\t\t<td";
6643 if( !m_miniSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
6644 *out
<< ">" << "<a name=\"_" << pSuffix
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pSuffix
, TRUE
, TRUE
) << "</a></td>\n";
6646 if( field
== CORPUS_COUNT_FIELD
)
6648 *out
<< "\t\t\t\t\t<td";
6649 if( !m_miniSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
6650 *out
<< ">" << pSuffix
->GetCorpusCount() << "</td>\n";
6652 if( field
== STEM_COUNT_FIELD
)
6654 *out
<< "\t\t\t\t\t<td";
6655 if( !m_miniSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
6656 *out
<< ">" << pSuffix
->GetUseCount() << "</td>\n";
6658 if( field
== DESC_LENGTH_FIELD
)
6660 *out
<< "\t\t\t\t\t<td";
6661 if( !m_miniSuffixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
6662 *out
<< ">" << pSuffix
->ComputeDL() << "</td>\n";
6665 line
= line
.mid( end
+ 1 );
6668 *out
<< "\t\t\t\t</tr>\n";
6670 if( m_miniSuffixesIncludeStemListFlag
->isChecked() )
6672 *out
<< "\t\t\t\t<tr>\n";
6673 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_miniSuffixesLine
->text().count( "%" ) / 2 ) << "\">\n";
6674 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
6675 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
6678 *out
<< "\t\t\t\t\t\t\t<tr>\n";
6679 //for( pStem = pSuffix->GetStems()->first(); pStem; pStem = pSuffix->GetStems()->next() )
6680 for (int z
= 0; z
< pSuffix
->GetStems()->size(); z
++)
6681 { pStem
= pSuffix
->GetStems()->at(z
);
6682 if( count
> 0 && count
% 5 == 0 )
6684 *out
<< "\t\t\t\t\t\t\t</tr>\n";
6685 *out
<< "\t\t\t\t\t\t\t<tr>\n";
6688 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
, type
, url
) << "</td>\n";
6691 while( count
> 5 && count
% 5 != 0 )
6693 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
6697 *out
<< "\t\t\t\t\t\t\t</tr>\n";
6699 *out
<< "\t\t\t\t\t\t</table><br>\n";
6700 *out
<< "\t\t\t\t\t</td>\n";
6701 *out
<< "\t\t\t\t</tr>\n";
6704 if( index
% 20 == 0 )
6706 *out
<< "\t\t\t\t<tr>\n";
6707 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_miniSuffixesLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
6708 *out
<< "\t\t\t\t</tr>\n";
6712 *out
<< "\t\t\t</table>\n";
6714 *out
<< getHTMLFooter();
6717 delete file
; file
= NULL
;
6718 delete out
; out
= NULL
;
6726 void ExportWizard::exportMiniPrefixes()
6734 StringToString
* filter
= m_pLexicon
->GetOutFilter();
6736 QMap
<QString
,int> fieldWidths
;
6742 QString line
, field
, fileName
, url
, type
= "stem";
6744 CMiniLexicon
* pMini
;
6745 for( mini
= 0; mini
< m_pLexicon
->GetMiniSize(); mini
++ )
6747 pMini
= m_pLexicon
->GetMiniLexicon(mini
);
6748 if( !pMini
|| !pMini
->GetPrefixes() ) continue;
6749 if( pMini
->GetPrefixes()->GetCount() == 0 ) continue;
6751 fileName
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_PREFIXES_FILE_TITLE
;
6752 fileName
.replace( " ", "_" );
6754 url
= m_projectName
->text() + QString( "_Mini_%1_" ).arg( pMini
->GetIndex() + 1 ) + MINI_STEMS_FILE_TITLE
+ ".html";
6755 url
.replace( " ", "_" );
6758 // Write simple text file
6759 if( m_simpleTextFlag
->isChecked() || m_bothFlag
->isChecked() )
6761 file
= new QFile( fileName
+ ".txt" );
6762 if( file
->open( QIODevice::WriteOnly
) )
6764 fieldWidths
.clear();
6767 if( m_miniPrefixesUniformFieldWidthsFlag
->isChecked() )
6769 if( m_miniPrefixesColumnTitlesFlag
->isChecked() )
6771 fieldWidths
[INDEX_FIELD
] = INDEX_FIELD_TITLE
.length();
6772 fieldWidths
[PREFIX_FIELD
] = PREFIX_FIELD_TITLE
.length();
6773 fieldWidths
[DESC_LENGTH_FIELD
] = DESC_LENGTH_FIELD_TITLE
.length();
6774 fieldWidths
[CORPUS_COUNT_FIELD
] = CORPUS_COUNT_FIELD_TITLE
.length();
6775 fieldWidths
[STEM_COUNT_FIELD
] = STEM_COUNT_FIELD_TITLE
.length();
6776 if( m_miniPrefixesIncludeStemListFlag
->isChecked() ) fieldWidths
[STEMS_FIELD
] = 0;
6779 pMini
->GetPrefixes()->Sort(PARSE_SIZE
);
6780 for( i
= 0; i
< pMini
->GetPrefixes()->GetCount(); i
++ )
6782 pPrefix
= pMini
->GetPrefixes()->GetAtSort(i
);
6784 if( m_miniPrefixesLine
->text().find( INDEX_FIELD
) >= 0 )
6786 width
= QString( "%1" ).arg( i
+ 1 ).length();
6787 if( width
> fieldWidths
[INDEX_FIELD
] ) fieldWidths
[INDEX_FIELD
] = width
;
6789 if( m_miniPrefixesLine
->text().find( PREFIX_FIELD
) >= 0 )
6791 width
= pPrefix
->Display( filter
).length();
6792 if( width
> fieldWidths
[PREFIX_FIELD
] ) fieldWidths
[PREFIX_FIELD
] = width
;
6794 if( m_miniPrefixesLine
->text().find( DESC_LENGTH_FIELD
) >= 0 )
6796 width
= QString( "%1" ).arg( pPrefix
->ComputeDL() ).length();
6797 if( width
> fieldWidths
[DESC_LENGTH_FIELD
] ) fieldWidths
[DESC_LENGTH_FIELD
] = width
;
6799 if( m_miniPrefixesLine
->text().find( CORPUS_COUNT_FIELD
) >= 0 )
6801 width
= QString( "%1" ).arg( pPrefix
->GetCorpusCount() ).length();
6802 if( width
> fieldWidths
[CORPUS_COUNT_FIELD
] ) fieldWidths
[CORPUS_COUNT_FIELD
] = width
;
6804 if( m_miniPrefixesLine
->text().find( STEM_COUNT_FIELD
) >= 0 )
6806 width
= QString( "%1" ).arg( pPrefix
->GetUseCount() ).length();
6807 if( width
> fieldWidths
[STEM_COUNT_FIELD
] ) fieldWidths
[STEM_COUNT_FIELD
] = width
;
6809 if( m_miniPrefixesIncludeStemListFlag
->isChecked() )
6812 //for( pStem = pPrefix->GetStems()->first(); pStem; pStem = pPrefix->GetStems()->next() )
6813 for (int z
= 0; z
< pPrefix
->GetStems()->size(); z
++)
6815 pStem
= pPrefix
->GetStems()->at(z
);
6816 if( width
< static_cast <int> (pStem
->Display( filter
).length()) ) width
= static_cast <int> ( pStem
->Display( filter
).length());
6818 if( width
> fieldWidths
[STEMS_FIELD
] ) fieldWidths
[STEMS_FIELD
] = width
;
6825 out
= new Q3TextStream( file
);
6826 out
->setEncoding( Q3TextStream::Unicode
);
6830 if( m_miniPrefixesColumnTitlesFlag
->isChecked() )
6834 line
= m_miniPrefixesLine
->text();
6836 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6838 while( line
.length() > 0 )
6840 start
= line
.find( "%" );
6848 *out
<< line
.left( start
);
6849 line
= line
.mid( start
);
6850 end
= line
.find( "%", 1 );
6851 field
= line
.mid( 0, end
+ 1 );
6853 if( field
== INDEX_FIELD
)
6856 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
6857 *out
<< INDEX_FIELD_TITLE
;
6859 if( field
== PREFIX_FIELD
)
6862 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
6863 *out
<< PREFIX_FIELD_TITLE
;
6865 if( field
== CORPUS_COUNT_FIELD
)
6868 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
6869 *out
<< CORPUS_COUNT_FIELD_TITLE
;
6871 if( field
== STEM_COUNT_FIELD
)
6874 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
6875 *out
<< STEM_COUNT_FIELD_TITLE
;
6877 if( field
== DESC_LENGTH_FIELD
)
6880 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
6881 *out
<< DESC_LENGTH_FIELD_TITLE
;
6884 line
= line
.mid( end
+ 1 );
6890 // Sort appropriately
6891 if( m_miniPrefixesCorpusCountSortFlag
->isChecked() ) pMini
->GetPrefixes()->Sort(CORPUSCOUNT
);
6892 else pMini
->GetPrefixes()->Sort(KEY
);
6894 // Output text file stuff
6896 for( i
= 0; i
< pMini
->GetPrefixes()->GetCount(); i
++ )
6898 pPrefix
= pMini
->GetPrefixes()->GetAtSort(i
);
6900 if( m_miniPrefixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
6902 line
= m_miniPrefixesLine
->text();
6904 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
6906 while( line
.length() > 0 )
6908 start
= line
.find( "%" );
6916 *out
<< line
.left( start
);
6917 line
= line
.mid( start
);
6918 end
= line
.find( "%", 1 );
6919 field
= line
.mid( 0, end
+ 1 );
6921 if( field
== INDEX_FIELD
)
6924 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[INDEX_FIELD
] );
6927 if( field
== PREFIX_FIELD
)
6930 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[PREFIX_FIELD
] );
6931 *out
<< pPrefix
->Display( filter
);
6933 if( field
== CORPUS_COUNT_FIELD
)
6936 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[CORPUS_COUNT_FIELD
] );
6937 *out
<< pPrefix
->GetCorpusCount();
6939 if( field
== DESC_LENGTH_FIELD
)
6942 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[DESC_LENGTH_FIELD
] );
6943 *out
<< pPrefix
->ComputeDL();
6945 if( field
== STEM_COUNT_FIELD
)
6948 if( fieldWidths
.count() > 0 ) out
->width( fieldWidths
[STEM_COUNT_FIELD
] );
6949 *out
<< pPrefix
->GetUseCount();
6952 line
= line
.mid( end
+ 1 );
6957 if( m_miniPrefixesIncludeStemListFlag
->isChecked() )
6960 if( m_miniPrefixesColumnTitlesFlag
->isChecked() )
6962 *out
<< "# " << STEMS_FIELD_TITLE
<< endl
;
6963 *out
<< "# -------------------------------------------\n";
6965 //for( pStem = pPrefix->GetStems()->first(); pStem; pStem = pPrefix->GetStems()->next() )
6966 for (int z
= 0; z
< pPrefix
->GetStems()->size(); z
++)
6967 { pStem
= pPrefix
->GetStems()->at(z
);
6968 if( count
% 5 == 0 )
6972 if( m_miniPrefixesColumnTitlesFlag
->isChecked() ) *out
<< " ";
6976 out
->width( fieldWidths
[STEMS_FIELD
] + 1 );
6977 *out
<< pStem
->Display( filter
);
6986 delete file
; file
= NULL
;
6987 delete out
; out
= NULL
;
6991 // Write mark-up file
6992 if( m_markUpFlag
->isChecked() || m_bothFlag
->isChecked() )
6994 file
= new QFile( fileName
+ ".html" );
6995 if( file
->open( QIODevice::WriteOnly
) )
6997 out
= new Q3TextStream( file
);
6998 out
->setEncoding( Q3TextStream::Unicode
);
7000 // Output html file stuff
7001 *out
<< getHTMLHeader( m_projectName
->text(), MINI_PREFIXES_FILE_TITLE
, m_language
->text(), m_researchers
->text(), pMini
->GetIndex() );
7003 *out
<< "\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"0px\">\n";
7006 if( m_miniPrefixesColumnTitlesFlag
->isChecked() )
7008 *out
<< "\t\t\t\t<tr>\n";
7010 line
= m_miniPrefixesLine
->text();
7012 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
7014 while( line
.length() > 0 )
7016 start
= line
.find( "%" );
7018 if( start
< 0 ) break;
7020 line
= line
.mid( start
);
7021 end
= line
.find( "%", 1 );
7022 field
= line
.mid( 0, end
+ 1 );
7024 if( field
== INDEX_FIELD
)
7026 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << INDEX_FIELD_TITLE
<< "</span></td>\n";
7028 if( field
== PREFIX_FIELD
)
7030 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << PREFIX_FIELD_TITLE
<< "</span></td>\n";
7032 if( field
== CORPUS_COUNT_FIELD
)
7034 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << CORPUS_COUNT_FIELD_TITLE
<< "</span></td>\n";
7036 if( field
== STEM_COUNT_FIELD
)
7038 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\" align=\"center\"><span class=\"title\">" << STEM_COUNT_FIELD_TITLE
<< "</span></td>\n";
7040 if( field
== DESC_LENGTH_FIELD
)
7042 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 2px solid #1B2025;\"><span class=\"title\">" << DESC_LENGTH_FIELD_TITLE
<< "</span></td>\n";
7045 line
= line
.mid( end
+ 1 );
7048 *out
<< "\t\t\t\t</tr>\n";
7052 // Sort appropriately
7053 if( m_miniPrefixesCorpusCountSortFlag
->isChecked() ) pMini
->GetPrefixes()->Sort(CORPUSCOUNT
);
7054 else pMini
->GetPrefixes()->Sort(KEY
);
7057 // Output html file stuff
7059 for( i
= 0; i
< pMini
->GetPrefixes()->GetCount(); i
++ )
7061 pPrefix
= pMini
->GetPrefixes()->GetAtSort(i
);
7063 *out
<< "\t\t\t\t<tr>\n";
7065 line
= m_miniPrefixesLine
->text();
7067 Q_ASSERT( line
.count( "%" ) % 2 == 0 );
7069 while( line
.length() > 0 )
7071 start
= line
.find( "%" );
7072 if( start
< 0 ) break;
7074 line
= line
.mid( start
);
7075 end
= line
.find( "%", 1 );
7076 field
= line
.mid( 0, end
+ 1 );
7078 if( field
== INDEX_FIELD
)
7080 *out
<< "\t\t\t\t\t<td";
7081 if( !m_miniPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
7082 *out
<< ">" << index
++ << "</td>\n";
7084 if( field
== PREFIX_FIELD
)
7086 *out
<< "\t\t\t\t\t<td";
7087 if( !m_miniPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
7088 *out
<< ">" << "<a name=\"_" << pPrefix
->Display( filter
) << "_\" class=\"bookmark\">" << getLParseText( pPrefix
, TRUE
, TRUE
) << "</a></td>\n";
7090 if( field
== CORPUS_COUNT_FIELD
)
7092 *out
<< "\t\t\t\t\t<td";
7093 if( !m_miniPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
7094 *out
<< ">" << pPrefix
->GetCorpusCount() << "</td>\n";
7096 if( field
== STEM_COUNT_FIELD
)
7098 *out
<< "\t\t\t\t\t<td";
7099 if( !m_miniPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
7100 *out
<< ">" << pPrefix
->GetUseCount() << "</td>\n";
7102 if( field
== DESC_LENGTH_FIELD
)
7104 *out
<< "\t\t\t\t\t<td";
7105 if( !m_miniPrefixesIncludeStemListFlag
->isChecked() ) *out
<< " style=\"border-bottom : 1px solid #5A6C7E;\"";
7106 *out
<< ">" << pPrefix
->ComputeDL() << "</td>\n";
7109 line
= line
.mid( end
+ 1 );
7112 *out
<< "\t\t\t\t</tr>\n";
7114 if( m_miniPrefixesIncludeStemListFlag
->isChecked() )
7116 *out
<< "\t\t\t\t<tr>\n";
7117 *out
<< "\t\t\t\t\t<td style=\"border-bottom : 1px solid #5A6C7E;\" colspan=\"" << ( m_miniPrefixesLine
->text().count( "%" ) / 2 ) << "\">\n";
7118 *out
<< "\t\t\t\t\t\t<span class=\"title\">" << STEMS_FIELD_TITLE
<< "</span><br>\n";
7119 *out
<< "\t\t\t\t\t\t<table cellspacing=\"0px\" cellpadding=\"5px\" border=\"1px\">\n";
7122 *out
<< "\t\t\t\t\t\t\t<tr>\n";
7123 //for( pStem = pPrefix->GetStems()->first(); pStem; pStem = pPrefix->GetStems()->next() )
7124 for (int z
= 0; z
< pPrefix
->GetStems()->size(); z
++)
7126 pStem
= pPrefix
->GetStems()->at(z
);
7127 if( count
> 0 && count
% 5 == 0 )
7129 *out
<< "\t\t\t\t\t\t\t</tr>\n";
7130 *out
<< "\t\t\t\t\t\t\t<tr>\n";
7133 *out
<< "\t\t\t\t\t\t\t\t<td>" << getLParseText( pStem
, TRUE
, FALSE
, type
, url
) << "</td>\n";
7136 while( count
> 5 && count
% 5 != 0 )
7138 *out
<< "\t\t\t\t\t\t\t\t<td> </td>\n";
7142 *out
<< "\t\t\t\t\t\t\t</tr>\n";
7144 *out
<< "\t\t\t\t\t\t</table><br>\n";
7145 *out
<< "\t\t\t\t\t</td>\n";
7146 *out
<< "\t\t\t\t</tr>\n";
7149 if( index
% 20 == 0 )
7151 *out
<< "\t\t\t\t<tr>\n";
7152 *out
<< "\t\t\t\t\t<td colspan=\"" + QString( "%1" ).arg( m_miniPrefixesLine
->text().count( "%" ) / 2 ) + "\" style=\"border-bottom : 1px solid #5A6C7E;\" align=\"right\"><a href=\"#top\">Return to top</a></td>\n";
7153 *out
<< "\t\t\t\t</tr>\n";
7157 *out
<< "\t\t\t</table>\n";
7159 *out
<< getHTMLFooter();
7162 delete file
; file
= NULL
;
7163 delete out
; out
= NULL
;
7170 void ExportWizard::exportIndex()
7172 QString projectName
= m_projectName
->text(),
7173 language
= m_language
->text(),
7174 researchers
= m_researchers
->text(),
7175 url
, projectTitle
= projectName
,
7178 CMiniLexicon
* pMini
;
7181 projectTitle
.replace( " ", "_" );
7183 QFile
* file
= new QFile( "index.html" );
7184 if( file
->open( QIODevice::WriteOnly
) )
7187 out
= new Q3TextStream( file
);
7188 out
->setEncoding( Q3TextStream::Unicode
);
7190 // Output html file stuff
7191 *out
<< getHTMLHeader( m_projectName
->text(), QString::null
, m_language
->text(), m_researchers
->text() );
7193 *out
<< "\t\t\t<table cellpadding=\"3px\" cellspacing=\"0px\" border=\"0px\">\n";
7195 if( ( m_brokenCorpusFlag
->isChecked() && m_pLexicon
->GetCorpus()->count() > 0 ) ||
7196 ( m_corpusWordsFlag
->isChecked() && m_pLexicon
->GetWords()->GetCount() > 0 ) )
7198 *out
<< "\t\t\t<tr>\n";
7199 *out
<< "\t\t\t\t<td colspan=\"3\"> </td>\n";
7200 *out
<< "\t\t\t</tr>\n\t\t\t<tr>\n";
7201 *out
<< "\t\t\t\t<td align=\"left\" colspan=\"3\"><div class=\"title\">Corpus:</div></td>\n";
7202 *out
<< "\t\t\t</tr>\n";
7204 if( m_brokenCorpusFlag
->isChecked() && m_pLexicon
->GetCorpus()->count() > 0 )
7206 *out
<< "\t\t\t\t<tr>\n";
7207 *out
<< "\t\t\t\t\t<td> </td>\n";
7208 *out
<< "\t\t\t\t\t<td>";
7210 url
= projectTitle
+ "_" + BROKEN_CORPUS_FILE_TITLE
+ ".html";
7211 url
.replace( " ", "_" );
7212 *out
<< "<a href=\"" + url
+ "\">";
7214 *out
<< BROKEN_CORPUS_FILE_TITLE
;
7219 if( m_pLexicon
->GetTokenCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 token</td>\n";
7220 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetTokenCount() << " tokens</td>\n";
7221 *out
<< "\t\t\t\t</tr>\n";
7223 if( m_corpusWordsFlag
->isChecked() && m_pLexicon
->GetWords()->GetCount() > 0 )
7225 *out
<< "\t\t\t\t<tr>\n";
7226 *out
<< "\t\t\t\t\t<td> </td>\n";
7227 *out
<< "\t\t\t\t\t<td>";
7229 url
= projectTitle
+ "_" + CORPUS_WORDS_FILE_TITLE
+ ".html";
7230 url
.replace( " ", "_" );
7231 *out
<< "<a href=\"" + url
+ "\">";
7233 *out
<< CORPUS_WORDS_FILE_TITLE
;
7238 if( m_pLexicon
->GetWords()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 word</td>\n";
7239 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetWords()->GetCount() << " words</td>\n";
7240 *out
<< "\t\t\t\t</tr>\n";
7244 if( ( m_allWordsFlag
->isChecked() && m_pLexicon
->GetAllWords()->count() > 0 ) ||
7245 ( m_allStemsFlag
->isChecked() && m_pLexicon
->GetAllStems()->count() > 0 ) ||
7246 ( m_compoundsFlag
->isChecked() && m_pLexicon
->GetCompounds()->GetCount() > 0 ) ||
7247 ( m_allSuffixesFlag
->isChecked() && m_pLexicon
->GetAllSuffixes()->count() > 0 ) ||
7248 ( m_allSuffixSigsFlag
->isChecked() && m_pLexicon
->GetAllSuffixSigs()->count() > 0 ) ||
7249 ( m_allPrefixesFlag
->isChecked() && m_pLexicon
->GetAllPrefixes()->count() > 0 ) ||
7250 ( m_allPrefixSigsFlag
->isChecked() && m_pLexicon
->GetAllPrefixSigs()->count() > 0 ) )
7252 *out
<< "\t\t\t<tr>\n";
7253 *out
<< "\t\t\t\t<td colspan=\"3\"> </td>\n";
7254 *out
<< "\t\t\t</tr>\n\t\t\t<tr>\n";
7255 *out
<< "\t\t\t\t<td align=\"left\" colspan=\"3\"><div class=\"title\">Lexicon:</div></td>\n";
7256 *out
<< "\t\t\t</tr>\n";
7258 if( m_allWordsFlag
->isChecked() && m_pLexicon
->GetAllWords()->count() > 0 )
7260 *out
<< "\t\t\t\t<tr>\n";
7261 *out
<< "\t\t\t\t\t<td> </td>\n";
7262 *out
<< "\t\t\t\t\t<td>";
7264 url
= projectTitle
+ "_" + ALL_WORDS_FILE_TITLE
+ ".html";
7265 url
.replace( " ", "_" );
7266 *out
<< "<a href=\"" + url
+ "\">";
7268 *out
<< ALL_WORDS_FILE_TITLE
;
7273 if( m_pLexicon
->GetAllWords()->count() == 1 ) *out
<< "\t\t\t\t\t<td>1 word</td>\n";
7274 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetAllWords()->count() << " words</td>\n";
7275 *out
<< "\t\t\t\t</tr>\n";
7277 if( m_allStemsFlag
->isChecked() && m_pLexicon
->GetAllStems()->count() > 0 )
7279 *out
<< "\t\t\t\t<tr>\n";
7280 *out
<< "\t\t\t\t\t<td> </td>\n";
7281 *out
<< "\t\t\t\t\t<td>";
7283 url
= projectTitle
+ "_" + ALL_STEMS_FILE_TITLE
+ ".html";
7284 url
.replace( " ", "_" );
7285 *out
<< "<a href=\"" + url
+ "\">";
7287 *out
<< ALL_STEMS_FILE_TITLE
;
7292 if( m_pLexicon
->GetAllStems()->count() == 1 ) *out
<< "\t\t\t\t\t<td>1 stem</td>\n";
7293 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetAllStems()->count() << " stems</td>\n";
7294 *out
<< "\t\t\t\t</tr>\n";
7296 if( m_allSuffixesFlag
->isChecked() && m_pLexicon
->GetAllSuffixes()->count() > 0 )
7298 *out
<< "\t\t\t\t<tr>\n";
7299 *out
<< "\t\t\t\t\t<td> </td>\n";
7300 *out
<< "\t\t\t\t\t<td>";
7302 url
= projectTitle
+ "_" + ALL_SUFFIXES_FILE_TITLE
+ ".html";
7303 url
.replace( " ", "_" );
7304 *out
<< "<a href=\"" + url
+ "\">";
7306 *out
<< ALL_SUFFIXES_FILE_TITLE
;
7311 if( m_pLexicon
->GetAllSuffixes()->count() == 1 ) *out
<< "\t\t\t\t\t<td>1 suffix</td>\n";
7312 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetAllSuffixes()->count() << " suffixes</td>\n";
7313 *out
<< "\t\t\t\t</tr>\n";
7315 if( m_allSuffixSigsFlag
->isChecked() && m_pLexicon
->GetAllSuffixSigs()->count() > 0 )
7317 *out
<< "\t\t\t\t<tr>\n";
7318 *out
<< "\t\t\t\t\t<td> </td>\n";
7319 *out
<< "\t\t\t\t\t<td>";
7321 url
= projectTitle
+ "_" + ALL_SUFFIX_SIGNATURES_FILE_TITLE
+ ".html";
7322 url
.replace( " ", "_" );
7323 *out
<< "<a href=\"" + url
+ "\">";
7325 *out
<< ALL_SUFFIX_SIGNATURES_FILE_TITLE
;
7330 if( m_pLexicon
->GetAllSuffixSigs()->count() == 1 ) *out
<< "\t\t\t\t\t<td>1 signature</td>\n";
7331 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetAllSuffixSigs()->count() << " signatures</td>\n";
7332 *out
<< "\t\t\t\t</tr>\n";
7334 if( m_allPrefixesFlag
->isChecked() && m_pLexicon
->GetAllPrefixes()->count() > 0 )
7336 *out
<< "\t\t\t\t<tr>\n";
7337 *out
<< "\t\t\t\t\t<td> </td>\n";
7338 *out
<< "\t\t\t\t\t<td>";
7340 url
= projectTitle
+ "_" + ALL_PREFIXES_FILE_TITLE
+ ".html";
7341 url
.replace( " ", "_" );
7342 *out
<< "<a href=\"" + url
+ "\">";
7344 *out
<< ALL_PREFIXES_FILE_TITLE
;
7349 if( m_pLexicon
->GetAllPrefixes()->count() == 1 ) *out
<< "\t\t\t\t\t<td>1 prefix</td>\n";
7350 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetAllPrefixes()->count() << " prefixes</td>\n";
7351 *out
<< "\t\t\t\t</tr>\n";
7353 if( m_allPrefixSigsFlag
->isChecked() && m_pLexicon
->GetAllPrefixSigs()->count() > 0 )
7355 *out
<< "\t\t\t\t<tr>\n";
7356 *out
<< "\t\t\t\t\t<td> </td>\n";
7357 *out
<< "\t\t\t\t\t<td>";
7359 url
= projectTitle
+ "_" + ALL_PREFIX_SIGNATURES_FILE_TITLE
+ ".html";
7360 url
.replace( " ", "_" );
7361 *out
<< "<a href=\"" + url
+ "\">";
7363 *out
<< ALL_PREFIX_SIGNATURES_FILE_TITLE
;
7368 if( m_pLexicon
->GetAllPrefixSigs()->count() == 1 ) *out
<< "\t\t\t\t\t<td>1 signature</td>\n";
7369 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetAllPrefixSigs()->count() << " signatures</td>\n";
7370 *out
<< "\t\t\t\t</tr>\n";
7372 if( m_compoundsFlag
->isChecked() && m_pLexicon
->GetCompounds()->GetCount() > 0 )
7374 *out
<< "\t\t\t\t<tr>\n";
7375 *out
<< "\t\t\t\t\t<td> </td>\n";
7376 *out
<< "\t\t\t\t\t<td>";
7378 url
= projectTitle
+ "_" + COMPOUNDS_FILE_TITLE
+ ".html";
7379 url
.replace( " ", "_" );
7380 *out
<< "<a href=\"" + url
+ "\">";
7382 *out
<< COMPOUNDS_FILE_TITLE
;
7387 if( m_pLexicon
->GetCompounds()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 compound</td>\n";
7388 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetCompounds()->GetCount() << " compounds</td>\n";
7389 *out
<< "\t\t\t\t</tr>\n";
7391 if( m_pLexicon
->GetLinkers()->GetCount() > 0 )
7393 *out
<< "\t\t\t\t<tr>\n";
7394 *out
<< "\t\t\t\t\t<td> </td>\n";
7395 *out
<< "\t\t\t\t\t<td>";
7397 url
= projectTitle
+ "_" + LINKERS_FILE_TITLE
+ ".html";
7398 url
.replace( " ", "_" );
7399 *out
<< "<a href=\"" + url
+ "\">";
7401 *out
<< LINKERS_FILE_TITLE
;
7406 if( m_pLexicon
->GetLinkers()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 linker</td>\n";
7407 else *out
<< "\t\t\t\t\t<td>" << m_pLexicon
->GetLinkers()->GetCount() << " linkers</td>\n";
7408 *out
<< "\t\t\t\t</tr>\n";
7414 for( mini
= 0; mini
< m_pLexicon
->GetMiniSize(); mini
++ )
7416 pMini
= m_pLexicon
->GetMiniLexicon(mini
);
7417 if( !pMini
|| !pMini
->GetWords() ) continue;
7418 if( pMini
->GetWords()->GetCount() == 0 ) continue;
7420 miniName
= QString( "Mini-Lexicon %1" ).arg( pMini
->GetIndex() + 1 );
7422 if( ( m_miniWordsFlag
->isChecked() && pMini
->GetWords() && pMini
->GetWords()->GetCount() > 0 ) ||
7423 ( m_miniSignaturesFlag
->isChecked() && pMini
->GetSignatures() && pMini
->GetSignatures()->GetCount() > 0 ) ||
7424 ( m_miniStemsFlag
->isChecked() && pMini
->GetStems() && pMini
->GetStems()->GetCount() > 0 ) ||
7425 ( m_miniPrefixesFlag
->isChecked() && pMini
->GetPrefixes() && pMini
->GetPrefixes()->GetCount() > 0 ) ||
7426 ( m_miniSuffixesFlag
->isChecked() && pMini
->GetSuffixes() && pMini
->GetSuffixes()->GetCount() > 0 ) )
7428 *out
<< "\t\t\t<tr>\n";
7429 *out
<< "\t\t\t\t<td colspan=\"3\"> </td>\n";
7430 *out
<< "\t\t\t</tr>\n\t\t\t<tr>\n";
7431 *out
<< "\t\t\t\t<td align=\"left\" colspan=\"3\"><div class=\"title\">" + miniName
+ ":</div></td>\n";
7432 *out
<< "\t\t\t</tr>\n";
7435 miniName
= QString( "Mini %1" ).arg( pMini
->GetIndex() + 1 );
7437 if( m_miniWordsFlag
->isChecked() && pMini
->GetWords() && pMini
->GetWords()->GetCount() > 0 )
7439 *out
<< "\t\t\t\t<tr>\n";
7440 *out
<< "\t\t\t\t\t<td> </td>\n";
7441 *out
<< "\t\t\t\t\t<td>";
7443 url
= projectTitle
+ "_" + miniName
+ "_" + MINI_WORDS_FILE_TITLE
+ ".html";
7444 url
.replace( " ", "_" );
7445 *out
<< "<a href=\"" + url
+ "\">";
7447 *out
<< MINI_WORDS_FILE_TITLE
;
7452 if( pMini
->GetWords()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 word</td>\n";
7453 else *out
<< "\t\t\t\t\t<td>" << pMini
->GetWords()->GetCount() << " words</td>\n";
7454 *out
<< "\t\t\t\t</tr>\n";
7456 if( m_miniStemsFlag
->isChecked() && pMini
->GetStems() && pMini
->GetStems()->GetCount() > 0 )
7458 *out
<< "\t\t\t\t<tr>\n";
7459 *out
<< "\t\t\t\t\t<td> </td>\n";
7460 *out
<< "\t\t\t\t\t<td>";
7462 url
= projectTitle
+ "_" + miniName
+ "_" + MINI_STEMS_FILE_TITLE
+ ".html";
7463 url
.replace( " ", "_" );
7464 *out
<< "<a href=\"" + url
+ "\">";
7466 *out
<< MINI_STEMS_FILE_TITLE
;
7471 if( pMini
->GetStems()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 stem</td>\n";
7472 else *out
<< "\t\t\t\t\t<td>" << pMini
->GetStems()->GetCount() << " stems</td>\n";
7473 *out
<< "\t\t\t\t</tr>\n";
7475 if( m_miniPrefixesFlag
->isChecked() && pMini
->GetPrefixes() && pMini
->GetPrefixes()->GetCount() > 0 )
7477 *out
<< "\t\t\t\t<tr>\n";
7478 *out
<< "\t\t\t\t\t<td> </td>\n";
7479 *out
<< "\t\t\t\t\t<td>";
7481 url
= projectTitle
+ "_" + miniName
+ "_" + MINI_PREFIXES_FILE_TITLE
+ ".html";
7482 url
.replace( " ", "_" );
7483 *out
<< "<a href=\"" + url
+ "\">";
7485 *out
<< MINI_PREFIXES_FILE_TITLE
;
7490 if( pMini
->GetPrefixes()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 prefix</td>\n";
7491 else *out
<< "\t\t\t\t\t<td>" << pMini
->GetPrefixes()->GetCount() << " prefixes</td>\n";
7492 *out
<< "\t\t\t\t</tr>\n";
7494 if( m_miniSuffixesFlag
->isChecked() && pMini
->GetSuffixes() && pMini
->GetSuffixes()->GetCount() > 0 )
7496 *out
<< "\t\t\t\t<tr>\n";
7497 *out
<< "\t\t\t\t\t<td> </td>\n";
7498 *out
<< "\t\t\t\t\t<td>";
7500 url
= projectTitle
+ "_" + miniName
+ "_" + MINI_SUFFIXES_FILE_TITLE
+ ".html";
7501 url
.replace( " ", "_" );
7502 *out
<< "<a href=\"" + url
+ "\">";
7504 *out
<< MINI_SUFFIXES_FILE_TITLE
;
7509 if( pMini
->GetSuffixes()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 suffix</td>\n";
7510 else *out
<< "\t\t\t\t\t<td>" << pMini
->GetSuffixes()->GetCount() << " suffixes</td>\n";
7511 *out
<< "\t\t\t\t</tr>\n";
7513 if( m_miniSignaturesFlag
->isChecked() && pMini
->GetSignatures() && pMini
->GetSignatures()->GetCount() > 0 )
7515 *out
<< "\t\t\t\t<tr>\n";
7516 *out
<< "\t\t\t\t\t<td> </td>\n";
7517 *out
<< "\t\t\t\t\t<td>";
7519 url
= projectTitle
+ "_" + miniName
+ "_" + MINI_SIGNATURES_FILE_TITLE
+ ".html";
7520 url
.replace( " ", "_" );
7521 *out
<< "<a href=\"" + url
+ "\">";
7523 *out
<< MINI_SIGNATURES_FILE_TITLE
;
7528 if( pMini
->GetSignatures()->GetCount() == 1 ) *out
<< "\t\t\t\t\t<td>1 signature</td>\n";
7529 else *out
<< "\t\t\t\t\t<td>" << pMini
->GetSignatures()->GetCount() << " signatures</td>\n";
7530 *out
<< "\t\t\t\t</tr>\n";
7534 *out
<< "\t\t\t</table>\n";
7536 *out
<< getHTMLFooter();
7539 delete file
; file
= NULL
;
7540 delete out
; out
= NULL
;