moj.lang.se
Class DecompounderConnection

java.lang.Object
  extended by moj.lang.se.DecompounderConnection

public class DecompounderConnection
extends java.lang.Object

DecompounderConnection handles all communication with a Decompounder server. Currently the decompounder only works with Swedish compounds. If you want to get all found decompounding alternatives for a compound, try using port 6150 instead of the default port 6140. For detailed information about the compound splitting, see Sjöbergh & Kann (2004,2006).

Version:
2006-Oct-12
Author:
Martin Hassel

Constructor Summary
DecompounderConnection()
          Create a new DecompounderConnection to the default host and port.
DecompounderConnection(java.lang.String host, int port)
          Create a new DecompounderConnection to the given host at the given port.
 
Method Summary
 java.lang.String decompound(java.lang.String text)
          Splits Swedish compounds recognized by Stava into its word parts (morfs).
static void main(java.lang.String[] args)
          Usage: moj.lang.se.DecompounderConnection <FILE|WORD|DEMO> <file|word>
<FILE|WORD|DEMO> : decompound words in a file, given word, or print demo output
<file|word> : file to decompound the words in, or word to decompound
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecompounderConnection

public DecompounderConnection(java.lang.String host,
                              int port)
Create a new DecompounderConnection to the given host at the given port.

Parameters:
host - Decompounder server host to connect to.
port - port on Decompounder server to connect to.

DecompounderConnection

public DecompounderConnection()
Create a new DecompounderConnection to the default host and port.

Method Detail

decompound

public java.lang.String decompound(java.lang.String text)
Splits Swedish compounds recognized by Stava into its word parts (morfs). For example, "barnvagnshjul" will yield the responce "barn|vagn|s|hjul" where the word parts are separated by a vertical bar (|). The reply is given inte form of one word per line and each line has the format compound\t(morf|morf(|morf)*)?. If Decompounder is unable to split the compound/word the second column will be empty.

Parameters:
text - String containing the words that are to be analyzed and potentially decompounded
Returns:
String with one word per line where each line has the format compound\t(morf|morf(|morf)*)?

main

public static void main(java.lang.String[] args)
Usage: moj.lang.se.DecompounderConnection <FILE|WORD|DEMO> <file|word>
<FILE|WORD|DEMO> : decompound words in a file, given word, or print demo output
<file|word> : file to decompound the words in, or word to decompound