Re: grammar checker in AbiWord

From: <msevior_at_physics.unimelb.edu.au>
Date: Tue Sep 20 2005 - 00:30:26 CEST

> On Monday 19 September 2005 03:21, Martin Sevior wrote:
>
>> Ah this is very interesting! Does it compile with gcj? Do you have or
>> plan to have an C/C++ API to access the functionality of your code?
>
> I have no experience with gcj. I guess compiling LanguageTool wouldn't be
> difficult but it makes use of some libraries which would also need to be
> compiled then I guess. Any help is appreciated.
>
> About the C API: I have no idea how to add one, can you get this
> automatically with gcj?
>

I have no experience with either java or gjc. I know that the
gnu-classpath project exists to provide free implementations of a large
number of the java libraries. You might be lucky have find yours already
implemented.

Regarding the implementation, we deliberately made the interface to the
link-grammar library as clean as possible.

We will just need to provide so glue code to implement two C++ methods.
in a subclass of the grammar checking wrapper we'd need to write.

class PieceOfText;

class ABI_EXPORT LinkGrammarWrap
{
  public:
  LinkGrammarWrap(void);
  virtual ~LinkGrammarWrap(void);
  bool parseSentence(PieceOfText * pT);
  bool clear(void);
 private:
  Dictionary m_Dict;
  Parse_Options m_Opts;
};

Where...

class ABI_EXPORT AbiGrammarError
{
 public:
  AbiGrammarError(void);
  virtual ~AbiGrammarError(void);
  UT_sint32 m_iErrLow;
  UT_sint32 m_iErrHigh;
  UT_uint32 m_iWordNum;
  UT_UTF8String m_sErrorDesc;
};

class ABI_EXPORT PieceOfText
{
 public:
  PieceOfText(void);
  virtual ~PieceOfText(void);
  UT_sint32 iInLow;
  UT_sint32 iInHigh;
  UT_sint32 nWords;
  bool bHasStop;
  UT_UTF8String sText;
  bool m_bGrammarChecked;
  bool m_bGrammarOK;
  UT_GenericVector<AbiGrammarError *> m_vecGrammarErrors;
  UT_UTF8String m_sSuggestion;
  UT_sint32 countWords(void);
};

We break text into sentences ourselves. and them into the PieceOfText class.
The vector m_vecGrammarErrors, contains a list of all the errors found in
the sentence along with potential suggestions for how to fix them.

From the description of your library it would prolly be a matter of less
than a week of real time to be grammar-checking on the fly with your
library provided we can work out the java-C/C++ issues.

We would just write a wrapper class around your library and compile it as
opposed to link-grammar.

Cheers

Martin

>> PS. I'm CCing the abiword-list. The rest of the development team will be
>> very interested in this.
>
> Feel free to forward this again if my CC doesn't work, as I'm not
> subscribed.
>
> Regards
> Daniel
>
> --
> http://www.danielnaber.de
>
Received on Tue, 20 Sep 2005 08:30:26 +1000 (EST)

This archive was generated by hypermail 2.1.8 : Tue Sep 20 2005 - 00:31:26 CEST