Skip to content

Instantly share code, notes, and snippets.

@JohnCoene
Created November 10, 2017 21:12
Show Gist options
  • Select an option

  • Save JohnCoene/016158db498178b7615b8d46469425c9 to your computer and use it in GitHub Desktop.

Select an option

Save JohnCoene/016158db498178b7615b8d46469425c9 to your computer and use it in GitHub Desktop.
R & openNLP
library(rJava)
library(NLP)
library(openNLP)
s <- "The UK has two weeks to clarify key issues or make concessions if progress is to be made in Brexit talks, the bloc's chief negotiator has said.
Michel Barnier was speaking after meeting the Brexit secretary for talks on citizens' rights, the Irish border, and the UK's 'divorce bill'.
David Davis said it was time for both sides 'to work to find solutions'. Before the talks, Theresa May said she wanted the UK's exit date set in law, and warned MPs not to block Brexit.Speaking at a press conference in Brussels, Mr Barnier suggested Britain would have to clarify its position in the next fortnight on what it would pay to settle its obligations to the EU if the talks were to have achieved 'sufficient progress' ahead of December's European Council meeting.
'It is just a matter of settling accounts as in any separation,' Mr Barnier said.Mr Barnier also said both sides had to work towards an 'objective interpretation' of Prime Minister Theresa May's pledge that no member of the EU would lose out financially as a result of the Brexit vote.
The Brexit secretary insisted good progress was being made across the board, and that the negotiations had narrowed to a 'few outstanding, albeit important, issues'. Mr Davis and Mr Barnier agreed there had been progress on the issue of settled status for EU citizens in the UK after Brexit.
Mr Barnier said the UK had provided 'useful clarifications' on guaranteeing rights, although more work needed to be done on some points including rights of families and exporting welfare payments.
For the UK's part, Mr Davis said, the government had 'listened carefully' to concerns and that there would be a 'streamlined and straightforwar' process for EU nationals to obtain settled status.
But Mr Davis rejected a suggestion that Northern Ireland could remain within the European customs union. He was responding to a European Commission paper, which proposed that Northern Ireland may have to remain a member of the EU's single market or customs union, if a so-called 'hard border' with the Irish Republic is to be avoided.
Michel Barnier usually says at post-negotiation press conferences that the clock is ticking. He didn't this time: he gave a specific timeframe. He wants the UK to provide more clarity in the next two weeks on its positions on the rights of EU citizens who wish to remain after Brexit, the plans for the Irish border and principles for calculating Britain's financial obligations.
Although the EU doesn't want a precise figure, it wants the UK to clarify what it's willing to pay to live up to the financial commitments made as a member.
On Ireland, both sides have pledged to protect the peace process but the EU has suggested that might require Northern Ireland sticking to European rules on customs and the single market - rules that the rest of Britain might not follow in future. David Davis rejected that.
UK sources agree it looks like they've been set a deadline but they feel it is a logical reading of the EU's timetable, under which their officials have to begin preparations for the next summit of EU leaders in December fairly soon."
text <- as.String(s)
word <- Maxent_Word_Token_Annotator()
sent <- Maxent_Sent_Token_Annotator()
pos <- Maxent_POS_Tag_Annotator()
pos_ann <- annotate(text, list(sent, word, pos))
txt_ann <- annotate(text, list(sent, word))
txt_doc <- AnnotatedPlainTextDocument(text, txt_ann)
ppl <- Maxent_Entity_Annotator(kind = "person")
loc <- Maxent_Entity_Annotator(kind = "location")
org <- Maxent_Entity_Annotator(kind = "organization")
date <- Maxent_Entity_Annotator(kind = "date")
annotations <- annotate(text, list(
sent,
word,
ppl,
loc,
org
))
text_doc <- AnnotatedPlainTextDocument(text, annotations)
entities <- function(doc, kind){
s <- doc$content
a <- annotations(doc)[[1]]
if(hasArg(kind)){
k <- sapply(a$features, "[[", "kind")
s[a[k == kind]]
} else {
s[a[a$type == "entity"]]
}
}
entities(text_doc, "person")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment