Taken:
-- ook weergeven in boomwords, lemmas
Met deze macro’s, voorbeeld:
match (adj:word{pos: 'adj'})<-[:rel]-(n)-[:rel]->(noun:word{pos: 'noun'})
match (n)<-[:rel*]-(pp:node{cat: 'pp'})<-[:rel{rel:'mod'}]-()
where noun.root in [%looksN%, %clothing%]
and adj.root in [%looksA%]
return adj, noun
Lijst van woorden onder een gezochte node:
-- 1: zoek iets
match (n:node{_deste: true})
return distinct n.sentid as sid, n.id
order by sid, id
-- 2: zoek woorden onder iets
match (n:node{_deste: true})
match (n)-[:rel*]->(w:word)
return distinct n.sentid as sid, n.id, w.end as positie, w.word as woord
order by sid, id, positie
-- 3: voeg de woorden per iets samen
select sid, id, string_agg(trim(both '"' from woord::text), ' ') as woorden
from (
match (n:node{_deste: true})
match (n)-[:rel*]->(w:word)
return distinct n.sentid as sid, n.id, w.end as positie, w.word as woord
order by sid, id, positie
) as foo
group by sid, id
order by sid, id
-- 3a: variant van 3 om te kijken of de woorden wel direct achter elkaar staan
select sid, id, string_agg(trim(both '"' from woord::text), ' ') as woorden
from (
match (n:node{_deste: true})
match (n)-[:rel*]->(w:word)
return distinct n.sentid as sid, n.id, w.end as positie, w.end + ' ' + w.word as woord
order by sid, id, positie
) as foo
group by sid, id
order by sid, id
-- 4: tel de frequenties van woorden onder iets
select count(woorden) as aantal, woorden
from (
select string_agg(trim(both '"' from woord::text), ' ') as woorden
from (
match (n:node{_deste: true})
match (n)-[:rel*]->(w:word)
return distinct n.sentid as sid, n.id as id, w.end as nummer, w.word as woord
order by sid, id, nummer
) as foo
group by sid, id
) as bar
group by woorden
order by aantal desc, woorden