From c764eee8d024b99d1be22575606a6a551d27e119 Mon Sep 17 00:00:00 2001 From: dchandler Date: Tue, 21 Oct 2003 03:36:57 +0000 Subject: [PATCH] Added a new warning for DMAR and others affected similarly affected by prefix rules, where seeing D+MAR, not D-MAR, could have caused an input operator to type in DMAR. This is a "Most" warning, but DMA causes a higher-priority "Some" warning. --- source/org/thdl/tib/text/ttt/PackageTest.java | 24 ++++++++++++ source/org/thdl/tib/text/ttt/TParseTree.java | 37 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/source/org/thdl/tib/text/ttt/PackageTest.java b/source/org/thdl/tib/text/ttt/PackageTest.java index 9cceea7..aa8d5ab 100644 --- a/source/org/thdl/tib/text/ttt/PackageTest.java +++ b/source/org/thdl/tib/text/ttt/PackageTest.java @@ -386,6 +386,22 @@ tstHelper("KA'", "[(K . A), (' . )]", new String[] { "{B}{DE}" }, "{B}{DE}"); + tstHelper("BDEm", "{B}{DEm}", + new String[] { "{B+DEm}", "{B}{DEm}" }, + new String[] { "{B}{DEm}" }, + "{B}{DEm}"); + + /* DLC FIXME + tstHelper("BDA:", "{B}{DA:}", + new String[] { "{B+DA:}", "{B}{DA:}" }, + new String[] { "{B}{DA:}" }, + "{B}{DA:}"); + + tstHelper("BDEm:", "{B}{DEm:}", + new String[] { "{B+DEm:}", "{B}{DEm:}" }, + new String[] { "{B}{DEm:}" }, + "{B}{DEm:}"); */ + tstHelper("NA+YA", "{N+}{YA}", new String[] { "{N+YA}" }, new String[] { "{N+YA}" }, @@ -7372,6 +7388,14 @@ tstHelper("ZUR"); } public void testACIPConversion() { + uhelp("DBA", "[#WARNING CONVERTING ACIP DOCUMENT: The ACIP DBA has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters.]\u0f51\u0f56"); + // DLC FIXME uhelp("BDEm:", "[#WARNING CONVERTING ACIP DOCUMENT: The ACIP BDEm: has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters.]\u0f56DLC\u0f7a\u0f7e\u0f7f"); + uhelp("DMAR", "[#WARNING CONVERTING ACIP DOCUMENT: The ACIP DMAR has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters.]\u0f51\u0f58\u0f62"); + uhelp("D+BA", "\u0f51\u0fa6"); + uhelp("MNA", "[#WARNING CONVERTING ACIP DOCUMENT: The ACIP MNA has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters.]\u0f58\u0f53"); + uhelp("DGRA", "[#WARNING CONVERTING ACIP DOCUMENT: The ACIP DGRA has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters.]\u0f51\u0f42\u0fb2"); + uhelp("D+GRA", "[#WARNING CONVERTING ACIP DOCUMENT: There is a stack of three or more consonants in D+GRA that uses at least one '+' but does not use a '+' between each consonant.]\u0f51\u0f92\u0fb2"); + uhelp("DGYA", "[#WARNING CONVERTING ACIP DOCUMENT: The ACIP DGYA has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters.]\u0f51\u0f42\u0fb1"); uhelp("NA+YA", "\u0f53\u0fb1"); // DLC FIXME: warn about the extra A uhelp("NE+YA", "[#ERROR CONVERTING ACIP DOCUMENT: THE TSHEG BAR (\"SYLLABLE\") NE+YA HAS THESE ERRORS: Cannot convert ACIP NE+-YA because + is not an ACIP consonant]"); uhelp("tRAStA", "\u0f4a\u0fb2\u0f66\u0f9a"); diff --git a/source/org/thdl/tib/text/ttt/TParseTree.java b/source/org/thdl/tib/text/ttt/TParseTree.java index 9041910..178ff85 100644 --- a/source/org/thdl/tib/text/ttt/TParseTree.java +++ b/source/org/thdl/tib/text/ttt/TParseTree.java @@ -374,6 +374,43 @@ class TParseTree { } } } + + // Check for DBA, DBE, DBIm:, etc. (i.e., DB*), BD*, DG*, DM* GD*, DN*, MN*, DGR*, DGY* + if (pl.size() >= 3) { + String left, middle, right; + left = pl.get(0).getLeft(); + middle = pl.get(1).getLeft(); + right = pl.get(2).getLeft(); + if (pl.get(0).getRight() == null + && !pl.get(1).endsACIPStack() + && pl.get(2).endsACIPStack() + && null != left && null != right) { + if (("D".equals(left) && "G".equals(middle) && "R".equals(right)) + || ("D".equals(left) && "G".equals(middle) && "Y".equals(right))) { + if (pl.size() == 3 || "Some" != warningLevel) + return "The ACIP " + ((null != originalACIP) ? originalACIP : recoverACIP()) + " has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters."; + } + } + } + if (pl.size() >= 2) { + String left, right; + left = pl.get(0).getLeft(); + right = pl.get(1).getLeft(); + if (pl.get(0).getRight() == null && pl.get(1).endsACIPStack() + && null != left && null != right) { + if (("D".equals(left) && "B".equals(right)) + || ("B".equals(left) && "D".equals(right)) + || ("D".equals(left) && "G".equals(right)) + || ("D".equals(left) && "M".equals(right)) + || ("G".equals(left) && "D".equals(right)) + || ("D".equals(left) && "N".equals(right)) + || ("M".equals(left) && "N".equals(right))) { + if (pl.size() == 2 || "Some" != warningLevel) + return "The ACIP " + ((null != originalACIP) ? originalACIP : recoverACIP()) + " has been interpreted as two stacks, not one, but you may wish to confirm that the original text had two stacks as it would be an easy mistake to make to see one stack and forget to input it with '+' characters."; + } + } + } + return null; }