1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
public void corpus()
{
try
{
InputStream ips=new FileInputStream("t.txt");
System.out.println("ssss");
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
while ((ligne=br.readLine())!=null)
{
try
{
lemme=ligne.substring(ligne.indexOf("(")+1, ligne.indexOf(")")-1);
System.out.println("lemmme "+lemme);
StringTokenizer st = new StringTokenizer(ligne,"()");
while (st.hasMoreTokens())
{
sens=st.nextToken();
System.out.println("defintion "+sens);
fichierxml( lemme, sens);
}
}
catch (StringIndexOutOfBoundsException e){}
catch(NoSuchElementException e){}
}}
catch (Exception e)
{
System.out.println(e.toString());
}
}
public void fichierxml(String lemme,String sens)
{
Element lexical = new Element("LexicalEntry");
racine.addContent(lexical);
Element lemma = new Element("Lemma");
lexical.addContent(lemma);
Element feat=new Element("Feat");
Attribute att = new Attribute("att","writtenForm");
feat.setAttribute(att);
Attribute val = new Attribute("val",lemme);
feat.setAttribute(val);
lemma.addContent(feat);
Element WordForm = new Element("WordForm");
lexical.addContent(WordForm);
Element feat1=new Element("Feat");
Attribute att1 = new Attribute("att","writtenForm");
feat1.setAttribute(att1);
Attribute val1 = new Attribute("val",lemme);
feat1.setAttribute(val1);
WordForm.addContent(feat1);
Element Sense = new Element("Sense");
lexical.addContent(Sense);
Element Definition = new Element("Definition");
Sense.addContent(Definition);
Element feat2=new Element("Feat");
Attribute att2 = new Attribute("att","text");
feat2.setAttribute(att2);
Attribute val2 = new Attribute("val",sens);
feat2.setAttribute(val2);
Definition.addContent(feat2);
} |
Partager