Is it possible to make a link between a person name and its PRP? in GATE E.g i have document "Maria Sharapova is a tennis player from russia. She participates in international tennis tournament. She is known for winning Wimbledon, US Open and Australian Open titles as for her looks, decibel-breaking grunts and commercial savvy - all of which made her the world's highest-paid female athlete." i want to annotate the "she" as "Maria Sharapova". I have written the following JAPE rule which identifies a pattern having a PRP after a person name
Phase: Simple
Input: Lookup Token Split
Options: control = appelt
Rule:joblookup
(
({Lookup.majorType == person_first}|
{Lookup.majorType == person_full})
({Token.kind==word})+
{Split.kind==internal}
{Token.category==PRP}
):sameathlete
-->
:sameathlete.sameAthlete1 = {kind="athlete", rule="same-athlete"}
How can i make the annotation that from She means we are talking about the same person whose name is mentioned 1 or 2 sentence before??
Please help
Have you tried Co-reference PR for gate?
Related
i'm going crazy, i have a string that should represent some kind of template that i should popolate with values in this format:
The Notes bear interest from and including ${expected_issuance_date}
at the rate of ${interest_rate} per cent. per annum, payable $${If
${Coupon_Period} = [Quarterly] ; Insert}{quarterly}$${If
${Coupon_Period} = [Semi-annual] ; Insert}{semi-annually}$${If
${Coupon_Period} = [Annual] ; Insert}{annually} in arrear on
${Issue_Date; Day}${Issue_Date; Month} every $${If ${Coupon_Period} =
[Quarterly] ; Insert}{3}$${If ${Coupon_Period} = [Semi-annual] ;
Insert}{6}$${If ${Coupon_Period} = [Annual] ; Insert}{12} months (each
an Interest Payment Date).
I cannot find any java (or javascript) library that seems using this format, does anyone have some hints? Thanks in advance!
It's GLML.
General-purpose Legal Mark-up Language (GLML) is an open-specification mark-up language that allows legal documents to become machine-readable and facilitates automation of capital markets. GLML is being supported and developed by the standalone GLML Consortium, which comprises leading capital markets law firms, banks, custodians, central securities depositories, exchanges, paying agents and ratings agencies.
Source: https://www.nivaura.com/nivaura-hosts-successful-industry-event-and-product-launch/
After years of using Excel and learning VBA, I am now trying to learn Python. Here's the scenario:
I asked 7 summer camp counselors which activities they would like to be in charge of. Each student had a random number of responses, and there is no upper limit on the number of activities chosen. However, each activity is unique, and once "claimed" by a student it cannot claimed by any other counselor. The results were:
Adam: archery, canoeing
Bob: frisbee, golf, painting, trampoline
Carol: tennis, dance, skating
Denise: cycling
Eddie: horseback, fencing, soccer
Fiona: painting
George: basketball, football
I'm most familiar with VB (I am an old guy) and in the past I would have stored the above info in a jagged array. But since I'm new to Python, I am confused as to how to do this. I think a list of lists would work for me and here is my code. Let's say I have a list of counselors, and separate lists for each counselors' activities. How do I merge them or put them in one data structure? What am I doing wrong below? Thank you.
counselors = []
counselors = ['Adam','Bob','Carol','Denise','Eddie','Fiona','George']
#create a list of Carol's activities
activities = []
activities = ['tennis','dance','skating']
counselors[2].append[(activities)]
A jagged array in Python is pretty much a list of lists as you mentioned.
I would use a dictionary to store the counselors activity information, where the key is the name of the counselor, and the value is the list of activities the counselor will be in charge of e.g.
counselors_activities = {"Adam": ["archery", "canoeing"],
"Bob": ["frisbee", "golf", "painting", "trampoline"],
"Carol": ["tennis", "dance", "skating"],
"Denise": ["cycling"],
"Eddie": ["horseback", "fencing", "soccer"],
"Fiona": ["painting"],
"George": ["basketball", "football"]}
And access each counselor in the dictionary as such:
counselors_activites["Adam"] # when printed will display the result => ['archery', 'canoeing']
In regards to the question, I would store the list of activities available in a list, and anytime an activity is chosen, remove it from the list and add it to the counselor in the dictionary as such:
list_of_available_activities.remove("archery")
counselors_activities["Adam"].append("archery")
And if a counselor no longer was in charge of the activity, remove it from them and add it back to the list of available activities.
Update: I have provided a more fully fledged solution below based on your requirements from your comments.
Text file, activites.txt:
Adam: archery, canoeing
Bob: frisbee, golf, painting, trampoline
Carol: tennis, dance, skating
Denise: cycling
Eddie: horseback, fencing, soccer
Fiona: painting
George: basketball, football
Code:
#Set of activities available for counselors to choose from
set_of_activities = {"archery",
"canoeing",
"frisbee",
"golf",
"painting",
"trampoline",
"tennis",
"dance",
"skating",
"cycling",
"horseback",
"fencing",
"soccer",
"painting",
"basketball",
"football"}
with open('activities.txt', 'r') as f:
for line in f:
# Iterate over the file and pull out the counselor's names
# and insert their activities into a list
counselor_and_activities = line.split(':')
counselor = counselor_and_activities[0]
activities = counselor_and_activities[1].strip().split(', ')
# Iterate over the list of activities chosen by the counselor and
# see if that activity is free to choose from and if the activity
# is free to choose, remove it from the set of available activities
# and if it is not free remove it from the counselor's activity list
for activity in activities:
if activity in set_of_activities:
set_of_activities.remove(activity)
else:
activities.remove(activity)
# Insert the counselor and their chosen activities into the dictionary
counselors_activities[counselor] = activities
# print(counselors_activities)
I have made one assumption with this new example, which is that you will already have a set of activities that can be chosen from already available:
I made the text file the same format of the counselors and their activities listed in the question, but the logic can be applied to other methods of storage.
As a side note and a correction from my second example previously, I have used a set to represent the list of activities instead of a list in this example. This set will only be used to verify that no counselor will be in charge of an activity that has already been assigned to someone else; i.e., removing an activity from the set will be faster than removing an activity from the list in worst case.
The counselors can be inserted into the dictionary from the notepad file without having to insert them into a list.
When the dictionary is printed it will yield the result:
{"Adam": ["archery", "canoeing"],
"Bob": ["frisbee", "golf", "painting", "trampoline"],
"Carol": ["tennis", "dance", "skating"],
"Denise": ["cycling"],
"Eddie": ["horseback", "fencing", "soccer"],
"Fiona": [], # Empty activity list as the painting activity was already chosen by Bob
"George": ["basketball", "football"]}
I'm trying to parse some text to find all references to a particular item. So, for example, if my item was The Bridge on the River Kwai and I passed it this text, I'd like it to find all the instances I've put in bold.
The Bridge on the River Kwai is a 1957 British-American epic war film
directed by David Lean and starring William Holden, Jack Hawkins, Alec
Guinness, and Sessue Hayakawa. The film is a work of fiction, but
borrows the construction of the Burma Railway in 1942–1943 for its
historical setting. The movie was filmed in Ceylon (now Sri Lanka).
The bridge in the film was near Kitulgala.
So far my attempt has been to go through all the mentions attached to each CorefChain and loop through those hunting for my target string. If I find the target string, I add the whole CorefChain, as I think this means the other items in that CorefChain also refer to the same thing.
List<CorefChain> gotRefs = new ArrayList<CorefChain>();
String pQuery = "The Bridge on the River Kwai";
for (CorefChain cc : document.get(CorefCoreAnnotations.CorefChainAnnotation.class).values()) {
List<CorefChain.CorefMention> corefMentions = cc.getMentionsInTextualOrder();
boolean addedChain = false;
for (CorefChain.CorefMention cm : corefMentions) {
if ((!addedChain) &&
(pQuery.equals(cm.mentionSpan))) {
gotRefs.add(cc);
addedChain = true;
}
}
}
I then loop through this second list of CorefChains, re-retrieve the mentions for each chain and step through them. In that loop I show which sentences have a likely mention of my item in a sentence.
for (CorefChain gr : gotRefs) {
List<CorefChain.CorefMention> corefMentionsUsing = gr.getMentionsInTextualOrder();
for (CorefChain.CorefMention cm : corefMentionsUsing) {
//System.out.println("Got reference to " + cm.mentionSpan + " in sentence #" + cm.sentNum);
}
}
It finds some of my references, but not that many, and it produces a lot of false positives. As might be entirely apparently from reading this, I don't really know the first thing about NLP - am I going about this entirely the wrong way? Is there a StanfordNLP parser that will already do some of what I'm after? Should I be training a model in some way?
I think a problem with your example is that you are looking for references to a movie title, and there isn't support in Stanford CoreNLP for recognizing movie titles, book titles, etc...
If you look at this example:
"Joe bought a laptop. He is happy with it."
You will notice that it connects:
"Joe" -> "He"
and
"a laptop" -> "it"
Coreference is an active research area and even the best system can only really be expected to produce an F1 of around 60.0 on general text, meaning it will often make errors.
I want to retrieve all <p> tags and then text from them in one string.
Problem 1. While running this code, it is giving all the tags too.
Problem 2. If I use loop for printing the con, it gives multiple strings. It will be clumsy if I append it again in one string.
So, How to get the text from the below code in short lines of code?
import re
import urllib.request
from bs4 import BeautifulSoup
requ = urllib.request.Request("http://www.chowrangi.pk/10-reasons-gender-equality-not-exist.html", headers={'User-Agent': 'Chrome/51.0.2704.103'})
htmll = urllib.request.urlopen(requ).read()
soupi = BeautifulSoup(htmll,"html.parser")
Con= soupi.findAll("p")
print(Con)
# for con in soup.findAll("p"):
# print("Paragraph :" ,con.text)
Just use a list comp and str.join to create one single string:
soup = BeautifulSoup(html, "html.parser")
Con = "".join([p.text for p in soup.find_all("p")])
print(Con)
Which gives you:
Women want equality, but they do not want to let go of their privileges. Women want freedom, but they do not want accountability. Women want to be liberated, but they do not want responsibility.Below are 15 reasons which shows how equality is only applicable when it works for women. Otherwise, women would be protesting against the following in order to achieve equality. It shows their hypocrisy and double standards. 1. Lifeboats are reserved for women.2. The media only focuses on women’s issues.3. World’s most dangerous jobs are worked by men.4. Seats are reserved for women on public transport.5. News channels announce deaths of ‘women’ and children.6. Juries discriminate against men in domestic violence disputes.7. Women have special quotas in the parliament, companies, and colleges.8. Women receive lighter sentences for the same crimes committed by men.9. Child custody is given to women is divorce courts, in the majority of cases.10. Men have to earn for women, but women are not under any obligation to earn for men.11. Domestic violence and dowry are seen as women’s issues, while men are the prime victims.12. Men give women child support and alimony, not the other way around. Men are ripped off their life savings.13. Men are used as ATMs. Women always marry men who are richer, earn more, ‘well-settled’, and better educated.14. Men die on jobs daily. 95% of work related deaths are of men, but that is neither an issue, not something that women and children are grateful for. 15. Draconian laws where women can land men behind bars with little evidence if any, giving a rise to false cases of dowry, rape, and domestic abuse. Police readily believe women, even though they lie more. Subscribe to our e-mail newsletter to receive updates.When blacks were forcrd to leave seats for whites, we called it slavery. When men are told to leave seats for women, we call it politeness! Why don’t women leave their seats for men?You need to add that women are released first in hostage situations, most teachers hired in schools are women, there is open discriminatory behaviour of teachers against boys in schools. men have to propose to women, women hitting men is socially acceptable, men make up the majority of homeless, war casualties, unemployed, suicides, compulsory conscription ….All the double standards are set by women.A man exposing in public = pervert
A woman exposing in public = liberatedMen seeking equal treatment = backlash
Women seeking equal treatment = feminismDiscrimination against men = equal opportunity
Discrimination against women = discriminationA woman with grievances = victim
A man with grievances = angryAny woman = victim
Any man = oppressorA woman talking about hating men = empowerment
A man talking about hating women = hate speechFemale genital mutilation = sexual repression
Male genital mutilation = acceptable customA man assaulting a women = violence
A woman assaulting a man = humorousA man who beats his female partner = batterer
A woman who beats her male partner = victimA disposable slave = man
A human being = womanHating women = a crime
Hating men = a viable political actAny power a man has = patriarchy
Any power a woman has = empowermentPornography pleasing to lesbians = erotica
Pornography pleasing to men = exploitation and degradation of womenPerson who say feminists are wrong = hate criminals
People who say men are wrong = feministsPatriarchy = bad
Matriarchy = goodMale leader = backwards
Female leader = improvementPro-lesbianism and female, anti-male = feminist ideology
Same standards, honest competition = unfairFemale virgin = pure
Male virgin = patheticFemale modesty = noble
Male modesty = creepyPandering to male audiences = sexism
Pandering to female audiences = fulfilling a nicheWomen standing up for themselves = empowerment
Men standing up for themselves = chauvinismWoman proud of her appearance = confident
Man proud of his appearance = vainInnate female advantages = complementary
Innate male advantages = sexistWomen’s space = safe haven
Men’s space = patriarchal breeding groundWomen discussing their issues = therapeutic
Men discussing their issues = whiningFemale intellect = pioneering
Male intellect = masturbatoryMan obeying a women = respect
Women obeying a man = slaveryMen being sexually critical = shallow
Women being sexually critical = having standardsFemale rage = man’s fault
Male rage = man’s faultMale abuse of power = direct consequence of patriarchy
Female abuse of power = indirect consequence of patriarchyUnemployed woman = homemaker
Unemployed man = loserFemale indulgence = success
Male indulgence = selfishnessComment Name (required) Email (will not be published) (required) Website
© 2016 Chowrangi. All Rights Reserved.
I am trying to present data from SQL Server in an Excel sheet so that operational users can understand the data. Here's how the data looks in SQL Server:
PersonId Name Address Role Organization
1 John Smith 123 Main St Donor Library
1 John Smith 123 Main St Member Ballet
2 Jane Doe 333 Main St Member Orchestra
As you can see the database contains a one-to-many relationship between a person and the role they play in an organization.
In my Excel I want to show the person record only once and somehow show that this person plays multiple roles and these are the roles.
There are lots of group concatenation methods out there. Some use dynamic sql and others use xml. Here's a simple one if you have a short list of roles known in advance. And this way you can control the order of the listing really easily.
select *,
(
select
substring(
coalesce(min(case when r.Role = 'Donor' then ', Donor' end), '') +
coalesce(min(case when r.Role = 'Member' then ', Member' end), '') +
...
coalesce(min(case when r.Role = 'XXXXXX' then ', XXXXXX' end), '')
, 3, 300)
from PersonRoles pr
where pr.PersonId = p.PersonId
) as Roles
from Person p
I'm not sure how organization fits into your problem but it appears to me that it's part of the role. You should be able to use pr.Role + ' ' + pr.Organization in the case logic for that.