Hi Sam,
Thank you for your quick reply.
To have a brief idea about CYK algorithm please have a look on the link below:
http://en.wikipedia.org/wiki/CYK_algorithm
There are two input xml like below I have to pass sentance.xml in the xslt and then based on the words in each sentance I have to read the values at runtime from the Rule.xml file and then produce the new XML given below.
1) sentance.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<sentances>
<sentance>dog bark</sentance>
<sentance>cat drink milk</sentance>
</sentances>
2) Rule.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<allrules>
<rules>
<rule cat="s">
<rulechild cat="np"/>
<rulechild cat="vp"/>
</rule>
<rule cat="vp">
<rulechild cat="vt"/>
<rulechild cat="np"/>
</rule>
<rule cat="vp">
<rulechild cat="vi"/>
</rule>
</rules>
<words>
<word cat="vi">bark</word>
<word cat="vt">drink</word>
<word cat="pn">dog</word>
<word cat="pn">cat</word>
<word cat="pn">milk</word>
</words>
</allrules>
OutPut XML should be like below:
Code:
<trees>
<tree>
<sentace>dog bark</sentace>
<node cat="s">
<node cat="np">
<word cat="pn">dog</word>
</node>
<node cat="vp">
<word cat="vi">bark</word>
</node>
</node>
</tree>
<tree>
<sentace>cat drink milk</sentace>
<node cat="s">
<node cat="np">
<word cat="pn">cat</word>
</node>
<node cat="vp">
<word cat="vt">drink</word>
<node cat="np">
<word cat="pn">milk</word>
</node>
</node>
</node>
</tree>
</trees>
Could it be possible to implement the CYK algorithm and produce the above out using XSLT.
Any idea or example code will be very greateful.
Thanks again.
John