-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.R
57 lines (40 loc) · 1.82 KB
/
main.R
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
setwd("C:/Users/Nelson/MEOCloud/Dissertation-work")
source("entity-processing.R")
source("logger.R")
source("debugger.R")
source("context-processing.R")
source("relation-detection.R")
source("EDA.R")
source("relation-extraction.R")
source("pair-treatment.R")
source("evaluation.R")
# TODO - Complete this.
operateRelationship<-function(entity.info, operation.option=1,
data.type="folder", content, idiom="pt", what.context="between",
only.consecutive=TRUE, dateline.removing="", exceptions=c(), use.stemming=TRUE)
{
start.time <- Sys.time()
#NE Pre-processing
every.entities<-extractEntities(source=textual.content, to="nothing")#
#Alternative
every.entities<-fileExtraction("extracted_entities.csv", TRUE, ",")
useful.entities<-cleanEntities(every.entities, special.cases = c(1643,2188))
counter<-countEntities(useful.entities)
confirmOccurrences(useful.entities, counter)
essential.entities<-filterSentences(useful.entities, counter)
#(...)
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken
}
binary.relations <- scanEfficiently(essential.entities)
relation.contexts<-aggregateContexts(binary.relations)
some.relations <- scanEfficiently(useful.entities)
frequency.pairs<-pairsDistribution(some.relations)
more.relations <- scanEfficiently(useful.entities)
clusters<-defineClustering(relation.contexts, words.number = 10)
new.clusters<-defineClustering(relation.contexts, dist.args = list(p=1.5),
kmeans.args=list(algorithm="Hartigan-Wong", trace=TRUE, iter.max=300))
#,dist.args=list(diag=TRUE,upper=TRUE)
#,kmeans.args=list(algorithm="Hartigan-Wong" ,trace=TRUE)
new.clusters2<-defineClustering(relation.contexts, kmeans.args=list(algorithm="Lloyd",iter.max=200))