Changeset 190 for trunk


Ignore:
Timestamp:
Jul 13, 2018, 5:16:39 PM (6 years ago)
Author:
chronos
Message:
  • Added: Support for document plural acronyms check.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/AcronymDecoder.lpi

    r184 r190  
    2222      <UseVersionInfo Value="True"/>
    2323      <MajorVersionNr Value="1"/>
    24       <MinorVersionNr Value="5"/>
     24      <MinorVersionNr Value="6"/>
    2525      <StringTable FileDescription="Acronym Decoder" ProductName="Acronym Decoder"/>
    2626    </VersionInfo>
  • trunk/Forms/UFormCheck.pas

    r186 r190  
    5555    function IsUppercaseAlpha(Text: string): Boolean;
    5656    function IsAlpha(Text: string): Boolean;
     57    function IsAcronym(Text: string): Boolean;
    5758    procedure ReportDifferencies;
    5859    function WordContainsLetters(Text, Letters: string): Boolean;
     
    7778  SAcronymCountContent = 'Content acronym count:';
    7879  SAcronymCountSummary = 'Summary acronym count:';
    79   SDuplicateAcronymContent = 'Duplicate acronym %s with "%s" in document content.';
    80   SDuplicateAcronymSummary = 'Duplicate acronym %s with "%s" in acronym summary.';
    81   SMissingAcronymContent = 'Content acronym %s with meaning "%s" missing from summary acronyms.';
    82   SMissingAcronymSummary = 'Summary acronym %s with meaning "%s" missing from content acronyms.';
    83 
     80  SDuplicateAcronymContent = 'Warning: Duplicate acronym %s with "%s" in document body.';
     81  SDuplicateAcronymSummary = 'Warning: Duplicate acronym %s with "%s" in acronym summary.';
     82  SMissingAcronymContent = 'Warning: Document body acronym %s with meaning "%s" missing from acronym summary.';
     83  SMissingAcronymSummary = 'Warning: Summary acronym %s with meaning "%s" missing from document body.';
     84  SPluralAcronym = 'Note: Acronym %s is defined as plural in document body.';
    8485
    8586{ TFormCheck }
     
    218219  HasMeaning1: Boolean;
    219220  HasMeaning2: Boolean;
     221  Plural: Boolean;
    220222begin
    221223  AcronymDbContent.Acronyms.Clear;
     
    232234      if EndIndex <> 0 then begin
    233235        Acronym := Trim(Copy(Text, StartIndex + 1, EndIndex - StartIndex - 1));
    234         if (Length(Acronym) > 1) and IsUppercaseAlpha(Acronym) then begin
     236        // Allow plural acronyms with ending 's' character
     237        if (Length(Acronym) >= 1) and (Acronym[Length(Acronym)] = 's') then begin
     238          Acronym := Copy(Acronym, 1, Length(Acronym) - 1);
     239          Plural := True;
     240        end else Plural := False;
     241        if IsAcronym(Acronym) then begin
    235242          HasMeaning1 := ParseMeaning(Acronym, Text, StartIndex - 1, Meaning1);
    236243          if HasMeaning1 then Meaning := Meaning1;
     
    242249          end;
    243250          if HasMeaning1 or HasMeaning2 then begin
     251            // If plural acronym then try to remove ending 's' character from the meaning
     252            if Plural then MemoReport.Lines.Add(Format(SPluralAcronym, [Acronym]));
     253            if Plural and (Length(Meaning) >= 1) and (Meaning[Length(Meaning)] = 's') then begin
     254              Meaning := Copy(Meaning, 1, Length(Meaning) - 1);
     255            end;
    244256            if Assigned(AcronymDbContent.SearchAcronym(Acronym, Meaning)) then
    245257              MemoReport.Lines.Add(Format(SDuplicateAcronymContent, [Acronym, Meaning]))
     
    360372end;
    361373
     374function TFormCheck.IsAcronym(Text: string): Boolean;
     375const
     376  MinAcronymLength = 2;
     377begin
     378  Result := (Length(Text) >= MinAcronymLength) and IsUppercaseAlpha(Text);
     379end;
     380
    362381procedure TFormCheck.ReportDifferencies;
    363382var
  • trunk/Languages/AcronymDecoder.cs.po

    r189 r190  
    928928
    929929#: uformcheck.sduplicateacronymcontent
    930 msgid "Duplicate acronym %s with \"%s\" in document content."
    931 msgstr "Zdvojená zkratka %s s významem \"%s\" v těle dokumentu."
     930msgid "Warning: Duplicate acronym %s with \"%s\" in document body."
     931msgstr "Varování: Zdvojená zkratka %s s významem \"%s\" v těle dokumentu."
    932932
    933933#: uformcheck.sduplicateacronymsummary
    934 msgid "Duplicate acronym %s with \"%s\" in acronym summary."
    935 msgstr "Zdvojená zkratka %s s významem \"%s\" v přehledu zkratek."
     934msgid "Warning: Duplicate acronym %s with \"%s\" in acronym summary."
     935msgstr "Varování: Zdvojená zkratka %s s významem \"%s\" v přehledu zkratek."
    936936
    937937#: uformcheck.smissingacronymcontent
    938 msgid "Content acronym %s with meaning \"%s\" missing from summary acronyms."
    939 msgstr "V zkratkách přehledu chybí zkratka obsahu %s s významem \"%s\"."
     938msgid "Warning: Document body acronym %s with meaning \"%s\" missing from acronym summary."
     939msgstr "Varování: V zkratkách přehledu chybí zkratka těla dokumentu %s s významem \"%s\"."
    940940
    941941#: uformcheck.smissingacronymsummary
    942 msgid "Summary acronym %s with meaning \"%s\" missing from content acronyms."
    943 msgstr "V zkratkách obsahu chybí zkratka přehledu %s s významem \"%s\"."
     942msgid "Warning: Summary acronym %s with meaning \"%s\" missing from document body."
     943msgstr "Ve zkratkách těla dokumentu chybí zkratka přehledu %s s významem \"%s\"."
     944
     945#: uformcheck.spluralacronym
     946msgid "Note: Acronym %s is defined as plural in document body."
     947msgstr "Poznámka: Zkratka %s je definována v těle dokumentu v množném čísle."
    944948
    945949#: uformexport.sexportedacronyms
     
    10341038msgid "Process import sources"
    10351039msgstr "Zpracovat zdroje importu"
    1036 
  • trunk/Languages/AcronymDecoder.po

    r184 r190  
    918918
    919919#: uformcheck.sduplicateacronymcontent
    920 msgid "Duplicate acronym %s with \"%s\" in document content."
     920msgid "Warning: Duplicate acronym %s with \"%s\" in document body."
    921921msgstr ""
    922922
    923923#: uformcheck.sduplicateacronymsummary
    924 msgid "Duplicate acronym %s with \"%s\" in acronym summary."
     924msgid "Warning: Duplicate acronym %s with \"%s\" in acronym summary."
    925925msgstr ""
    926926
    927927#: uformcheck.smissingacronymcontent
    928 msgid "Content acronym %s with meaning \"%s\" missing from summary acronyms."
     928msgid "Warning: Document body acronym %s with meaning \"%s\" missing from acronym summary."
    929929msgstr ""
    930930
    931931#: uformcheck.smissingacronymsummary
    932 msgid "Summary acronym %s with meaning \"%s\" missing from content acronyms."
     932msgid "Warning: Summary acronym %s with meaning \"%s\" missing from document body."
     933msgstr ""
     934
     935#: uformcheck.spluralacronym
     936msgid "Note: Acronym %s is defined as plural in document body."
    933937msgstr ""
    934938
Note: See TracChangeset for help on using the changeset viewer.