string template format unknown - string

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/

Related

Keep track of expenses c#

I am creating an application where the user shall be able to enter the following values:
gross monthly income (before deductions).
estimated monthly tax deducted.
groceries
water and lights
travel costs (including petrol)
cellphone and telephone
other expenses
The user shall be to choose between renting accommodation or buying a property if the the user selects to rents, the user will enter the monthly rental amount
if the user selects to buy a property, the user shall be required to enter the following values for a home loan:
purchase price of property
total deposit
interest rate
number of months to repay
The software shall calculate the monthly home loan repayment for buying a property based of the values that the user entered.
If the monthly home loan repayment is more than a third of the user's gross monthly income, the software shall alert that approval of the home loan is unlikely/
The software shall calculate the available monthly money after all the specified deductions have been made.
The software shall not persist the user data between runs. The data shall only be stored in memory while the software is running.
Please help me out with the code c#.
This should be fairly straight forward, it sounds like the program is supposed to be written entirely in the console which makes things a lot simpler.
Most of the code should use Console.WriteLine(String) and Console.ReadLine().
For example:
double netMonthlyIncome = 0;
Console.WriteLine("Enter gross monthly income:");
double gmi = Double.Parse(Console.ReadLine());
Console.WriteLine("Enter estimated monthly taxes:");
double emt = Double.Parse(Console.ReadLine());
netMonthlyIncome = gmi - emt;
What this code is doing is calling a built-in function to write a string to the console window, and setting up a double variable to hold the result from the console. The ReadLine function will wait for a user to hit enter and will take anything they wrote before enter and return it in a string variable. The Double.Parse() function takes this string and attempts to convert it to a number. The final step is that the gross monthly income variable will have the estimated monthly taxes subtracted from it to a seperate variable, this would be repeated for the other expenses. To go an extra step, you should include some checks to verify the inputs. For example:
double netMonthlyIncome = 0;
Console.WriteLine("Enter gross monthly income:");
String inputText = Console.ReadLine();
while(!Double.TryParse(inputText)) {
Console.WriteLine("That couldn't be interpreted, please re-enter a number:")
inputText = Console.ReadLine();
}
double gmi = Double.Parse(inputText);
In this example, the user would be prompted once to input the gross monthly income, but the TryParse function checks to see if the input is able to be converted to a double, and returns true if it can be. The ! will reverse whatever the result is, so if the TryParse returns true, the ! makes it false and the while() statement is skipped. If the TryParse returns false, the ! makes it true, and the while loop is entered where the user is prompted to re-enter a number, and will continue to be prompted until the TryParse is able to get a number out of it. This is, in some form, good practice to prevent a user from entering something like "Apples" and breaking the program.
After that, you would use similar prompts with new variables to get the cost of groceries, utilities, travel, etc. and use:
netMonthlyIncome = netMonthlyIncome - groceries - utilities - travel - ...;
You'd also use similar prompts to get the loan values, in this example I'll use 'a' as the loan amount, 'r' as the interest, and 'n' as the number of months. The formula should be double monthlyLoanPayment = a * (r(1+r)^n)/((1+r)^n - 1). It's maybe not the most efficient but personally I like to separate out everything to avoid any accidental syntax issues with order of operations.
So, you'd have:
r = r/12; // convert yearly interest to monthly interest
double numerator = r*Math.pow((1+r),n); //this is equivalent to r*(1+r)^n
double denominator = Math.pow(1+r,n) - 1; //this is equivalent to (1+r)^n - 1
double monthlyLoanPayment = a * (numerator/denominator);
if(monthlyLoanPayment >gmi/3) {
Console.WriteLine("This loan will probably get denied");
} else {
Console.WriteLine("This loan will probably get approved");
}
netMonthlyIncome = netMonthlyIncome - netMonthlyLoanPayment;
Console.WriteLine("Money Available each month:");
Console.WriteLine(netMonthlyIncome);

Dynamic visualization for top n values

I have a dataset that looks like:
Date CONSUMER DISCR CONSUMER STAPLES ENERGY FINANCIALS HEALTH CARE INDUSTRIALS INFORMATION TECH MATERIALS REAL ESTATE TELECOM SVC UTILITIES
2/28/2006 0.16630621 0.045185409 0.044640056 0.123505969 0.053980333 0.088535648 0.234666154 0.119729025 0.034316211 0.067272708 0.021862279
3/31/2006 0.13323423 0.0135331245 0.022255232 0.124240924 0.054290724 0.088825904 0.055432 0.118432505 0.03418562 0.066877285 0.33847323
Each of the numbers for the sectors indicates the importance of the industry to the stock market. I am not interested in all industries but the top n most important ones. (the higher the number, the more important the industry is).
I want a method in Excel that dynamically visualizes the top n values for each date. For example, for 2/28/2006, for n = 4, it should visualizeINFORMATION TECH, CONSUMER DISCR, FINANCIALS, and MATERIALS.
For 3/31/2006, for n = 4, it should visualizeUTILITIES, CONSUMER DISCR, FINANCIALS, and MATERIALS
What method exists in Excel?
Per the supplied image,
=INDEX($1:$1, , MATCH(LARGE($B2:$L2, COLUMN(A:A)), $A2:$L2, 0))
use something like this:
=IF(ROW(1:1) >$O$1,"",INDEX($A$1:$L$1,AGGREGATE(15,6,COLUMN($B$1:$L$1)/(INDEX($B$2:$L$3,MATCH($O$2,$A$2:$A$3,0),0)=LARGE(INDEX($B$2:$L$3,MATCH($O$2,$A$2:$A$3,0),0),ROW(1:1))),1)))
You would put this in the first cell and copy down far enough to satisfy the largest n possible.

Find all references to a supplied noun in StanfordNLP

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.

making link between a person name and pronoun in GATE

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?

shell script to extract multiline data out of a text file with regex

i am trying to extract some specific data out of a text file using regular expressions with shell script
that is using a multiline grep .. and the tool i am using is pcregrep so that i can get compatibility with perl's regular expressions
[58]Walid Chamoun Architects WLL
* [59]Map
* [60]Website
* [61]Email
* [62]Profile
* [63]Display Ad
Walid Chamoun Architects WLL
PO Box:
55803, Doha, Qatar
Location:
D-Ring Road, New Salata Shamail 40, Villa 340, Doha, Qatar
Tel:
(00974) 44568833
Fax:
(00974) 44568811
Mob:
(00974) 44568822
* Accurate Budget Costing
* Eco-Friendly Structural Design
* Exclusive & Unique Design
* Quality Architecture & Design
Company Profile
Walid Chamoun Architects (WCA) was founded in Beirut, Lebanon, in 1992,
committed to the concept of fully integrated design-build delivery of
projects. In late '90s, company established in-house architectural and
engineering services. As a full service provider, WCA expanded from
multi-family projects to industrial and office construction, which
added development services, including site acquisition and financing.
In 2001, WCA had opportunity and facilities to experience European
market and establish office in Puerto Banus, Marbella, Spain. By 2005,
WCA refined its structure to focus on specific market segments and new
office was opened in Doha, state of Qatar. From a solid foundation and
reputation built over eighteen years, WCA continually to provide
leadership in design-build through promotion of benefits and education
to its practitioners.
Project Planning: Project planning and investigation occurs before
design begins has greatest impact on cost, schedule and ultimately the
success of project. Creativity in Design: You can rely on our in-house
designers for design excellence in all aspects of the project. Our
designs have received recommendations and appreciations on national and
international levels. Creativity in Execution: Experienced in close
collaboration with the designers as part of the integrated team, our
construction managers, superintendents and field staff create value
throughout the project. Post Completion Services: Your needs can be
served through our skills and experience long after the last
construction crew has left the site. Performance: Corporate and
institutional clients, developers and public agencies repeatedly select
WCA on the basis of its consistent record of performance excellence.
Serving clients throughout the Middle East and GCC, WCA provides
complete planning for architectural, interior design and construction
on a single-responsibility basis. Our expertise spans industrial,
commercial, institutional, public and residential projects. Benefits of
Design-Build: Design-build is a system of contracting under which one
entity performs both design and construction. Benefits of design-build
project delivery include: Single point responsibility Early knowledge
of cost Time and Cost savings
Classification:
Architects - [64]Architects
[65]Al Ali Consulting & Engineering
* [66]Map
* Website
* Email
* Profile
* Display Ad
Is this your company?
[67]Upgrade this free listing here
PO Box:
467, Doha, Qatar
Tel:
(00974) 44360011
Company Profile
Classification:
Architects - [68]Architects
[69]Al Gazeerah Consulting Engineering
* [70]Map
* Website
* Email
* Profile
* Display Ad
Is this your company?
[71]Upgrade this free listing here
PO Box:
22414, Doha, Qatar
Tel:
(00974) 44352126
Company Profile
Classification:
Architects - [72]Architects
[73]Al Murgab Consulting Engineering
* [74]Map
* Website
* Email
* Profile
* Display Ad
Is this your company?
[75]Upgrade this free listing here
PO Box:
2856, Doha, Qatar
Tel:
(00974) 44448623
Company Profile
Classification:
Architects - [76]Architects
References
Visible links
1. http://www.qatcom.com/useraccounts/login
2. http://www.qatcom.com/useraccounts/register
3. http://www.qatcom.com/
4. http://www.qatcom.com/
5. http://www.qatcom.com/qataryellowpages/map-of-doha
6. http://www.qatcom.com/qataryellowpages/about-qatcom
7. http://www.qatcom.com/qataryellowpages/advertise-with-qatcom
8. http://www.qatcom.com/qataryellowpages/advertiser_testimonials
9. http://www.qatcom.com/useraccounts/login
10. http://www.qatcom.com/useraccounts/register
11. http://www.qatcom.com/contact-qatcom
12. http://www.qatcom.com/qataryellowpages/companies
13. http://www.qatcom.com/classifications/index/A
14. http://www.qatcom.com/classifications/index/B
15. http://www.qatcom.com/classifications/index/C
16. http://www.qatcom.com/classifications/index/D
17. http://www.qatcom.com/classifications/index/E
18. http://www.qatcom.com/classifications/index/F
19. http://www.qatcom.com/classifications/index/G
20. http://www.qatcom.com/classifications/index/H
21. http://www.qatcom.com/classifications/index/I
22. http://www.qatcom.com/classifications/index/J
23. http://www.qatcom.com/classifications/index/K
24. http://www.qatcom.com/classifications/index/L
25. http://www.qatcom.com/classifications/index/M
26. http://www.qatcom.com/classifications/index/N
27. http://www.qatcom.com/classifications/index/O
28. http://www.qatcom.com/classifications/index/P
for a sample data like this, i am trying to grab the details of companies namely
company name
po box
Tel
fax
mobile
company profile
into a .csv file
i am new to regular expressions and linux too..
all i could manage to get was something like this
\[\d*\][^\.]*[\(\d*\)\s\d*)]
can anyone help me out with this please..
improvements:
i figured out something like this
$ awk '/^\[/ && ! /Upgrade this free listing/ {print $0} /:$/ && ! /Classification/ {printf $0 ; getline x ; print x}' file
but that still isn't what i want it to be...
You can do this in awk, but you'll be better off parsing the HTML instead. A good tool to do that with would be Python using the Beautiful Soup module. But that's not very exciting, so here's how to do it the awkward (hah!) way:
#!/usr/bin/awk -f
function trim(s) {
gsub(/(^ +)|( +$)/, "", s)
return s
}
BEGIN {
count = 0
fields[0] = "company"
fields[1] = "pobox"
fields[2] = "tel"
fields[3] = "fax"
fields[4] = "mob"
fields[5] = "profile"
}
# company name
/^ +\[[0-9]+\].*$/ {
sub(/^ +\[[0-9]+\]/, "") # get rid of the Lynx reference
# this is a bit naughty: our regex also matches this other link, but there's only one of them, so we just filter it
if ($0 != "Upgrade this free listing here") data[count,"company"]=$0
}
# two line fields, easy!
/ +PO Box:$/ { getline; data[count,"pobox"]=$0 }
/ +Tel:$/ { getline; data[count,"tel"]=$0 }
/ +Fax:$/ { getline; data[count,"fax"]=$0 }
/ +Mob:$/ { getline; data[count,"mob"]=$0 }
# multi-line field, tricky because it can be empty
/^Company Profile$/ {
getline # skip empty line
# process lines until encountering Classification field
s = ""
do {
s = s $0
getline
} while ($0 !~ / +Classification:$/)
data[count,"profile"]=s
count++ # the Classification field denotes the end of the company record
}
END {
OFS=","
# output CSV header row
for ( key in fields ) {
printf "\"" fields[key] "\","
}
printf "\n"
# output data
for ( i=0; i<count; i++ ) {
for ( key in fields ) {
printf "\"" trim(data[i,fields[key]]) "\","
}
printf "\n"
}
}
Save as parse.awk and then invoke with ./parse.awk < sample.txt. Out comes a CSV, like this:
"tel","fax","mob","profile","company","pobox",
"(00974) 44568833","(00974) 44568811","(00974) 44568822","Walid Chamoun Architects (WCA) was founded in Beirut, Lebanon, in 1992, committed to the blablabla","Walid Chamoun Architects WLL","55803, Doha, Qatar",
"(00974) 44360011","","","","Al Ali Consulting & Engineering","467, Doha, Qatar",
"(00974) 44352126","","","","Al Gazeerah Consulting Engineering","22414, Doha, Qatar",
"(00974) 44448623","","","","Al Murgab Consulting Engineering","2856, Doha, Qatar",
There's comments that should hopefully explain what's going on. This will run in plain old awk and doesn't require fancy gawk features. Keep in mind that awk arrays are arbitrarily ordered. This is prone to breaking a whole bunch with varying input data, which is just one of the many reasons why you really should parse the HTML instead of such lynx -dump shenanigans.

Resources