moj.lang.statserv
Class StatServConnection

java.lang.Object
  extended by moj.lang.statserv.StatServConnection

public class StatServConnection
extends java.lang.Object

StatServConnection handles all communication with a StatServ server.

StatServ TODO:
- When adding to a document set the response should contain the number of tokens added - A StatServRequest should be able to contain a request for a list of available docsets, e.g. . The response should contain the number of documents and terms represented in each docset as well, possibly, a comment.
- Support in the XML for sending a list of tag-disambiguated lemma or inflected words to the server instead of running text (i.e. one instance of each token)
- Extend the XML request to allow sending parameters to a module
- n-gram module with configurable n

Version:
2007-Nov-02
Author:
Martin Hassel

Field Summary
 java.lang.String ampersand
          Characters that break the request
 java.lang.String procent
           
 java.net.URL statservURL
          URL to current StatServ servlet
 
Constructor Summary
StatServConnection()
          Create a new StatServConnection to the StatServ server given in the file StatServ.properties.
 
Method Summary
 boolean addModule(StatServRequest module)
          Adds a StatServRequest module to the connection.
static void main(java.lang.String[] args)
           
 boolean removeModule(StatServRequest module)
          Removes a StatServRequest module from the connection.
 void removeModules()
          Removes all StatServRequest modules from the connection.
 java.lang.String requestXML(java.lang.String title, java.lang.String text)
          Returns the XML that constitutes a StatServConnection request.
 java.lang.String StatServConnect(java.lang.String title, java.lang.String text)
          Sends the text and title to a StatServ servlet and lets each previously addedStatServRequest module request and parse its own statistics, which is then made available through each StatServRequest module respectively.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statservURL

public final java.net.URL statservURL
URL to current StatServ servlet


ampersand

public java.lang.String ampersand
Characters that break the request


procent

public java.lang.String procent
Constructor Detail

StatServConnection

public StatServConnection()
                   throws java.net.MalformedURLException
Create a new StatServConnection to the StatServ server given in the file StatServ.properties.

Throws:
java.net.MalformedURLException
Method Detail

addModule

public boolean addModule(StatServRequest module)
Adds a StatServRequest module to the connection.

Parameters:
module - StatServRequest module to add
Returns:
true on success, else false

removeModule

public boolean removeModule(StatServRequest module)
Removes a StatServRequest module from the connection.

Parameters:
module - StatServRequest module to remove
Returns:
true on success, else false

removeModules

public void removeModules()
Removes all StatServRequest modules from the connection.


requestXML

public java.lang.String requestXML(java.lang.String title,
                                   java.lang.String text)
Returns the XML that constitutes a StatServConnection request.

Parameters:
title - the title of the document statistics is requested for
text - the text statistics is requested for
Returns:
XML representing a StatServConnection request

StatServConnect

public java.lang.String StatServConnect(java.lang.String title,
                                        java.lang.String text)
Sends the text and title to a StatServ servlet and lets each previously addedStatServRequest module request and parse its own statistics, which is then made available through each StatServRequest module respectively.

Parameters:
title - the title of the document statistics is requested for
text - the text statistics is requested for
Returns:
the answer from the StatServ server as sent to each added StatServRequest

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception