Good idea for stemming=basic. I would write the put like this, though:

map:put($map, cts:stem($x),
  (map:get($map, cts:stem($x)), $x))

That way you accumulate all the words that stem the same, instead of just the 
last one for each stem.

But both approaches may break with advanced stemming, because some words will 
have multiple stems. Function mapping might take care of that, though - and if 
not you could write a FLWOR.

-- Mike

On May 11, 2012, at 15:13, Danny Sokolsky <danny.sokol...@marklogic.com> wrote:

> If you have a word lexicon you can do something like this to get information 
> about your words and stems:
>  
> let $map := map:map()
> let $all :=
>   for $x in cts:words()
>   return map:put($map, cts:stem($x), $x)
> return (
> fn:concat(xs:string(fn:count(map:keys($map))), " unique stems in the 
> database"),
> fn:concat(fn:count(cts:words()), " unique words in the database
> "),
> map:keys($map) )
>  
> -Danny
>  
> From: general-boun...@developer.marklogic.com 
> [mailto:general-boun...@developer.marklogic.com] On Behalf Of Michael Blakeley
> Sent: Friday, May 11, 2012 2:02 PM
> To: MarkLogic Developer Discussion
> Cc: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Term with same stem
>  
> If stemming=advanced I think cts:stem will do that. With basic the best you 
> can do is to pass terms to cts:stem and see if they have the same stem.
> 
> -- Mike
> 
> On May 11, 2012, at 13:39, Abhishek53 S <abhishek5...@tcs.com> wrote:
> 
> Hi Folks,
>  
> Is it possible to get the all terms that have same stem from Marklogic 
> database? I want to get all terms that belongs to the same stem.
> 
> Thanks & Regards
> Abhishek Srivastav
> Systems Engineer
> Tata Consultancy Services
> Cell:- +91-9883389968
> Mailto: abhishek5...@tcs.com
> Website: http://www.tcs.com
> ____________________________________________
> Experience certainty. IT Services
> Business Solutions
> Outsourcing
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain 
> confidential or privileged information. If you are 
> not the intended recipient, any dissemination, use, 
> review, distribution, printing or copying of the 
> information contained in this e-mail message 
> and/or attachments to it are strictly prohibited. If 
> you have received this communication in error, 
> please notify us by reply e-mail or telephone and 
> immediately and permanently delete the message 
> and any attachments. Thank you
> 
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to