Form Sentences in Present tense from Words - nltk

I need to convert sentences from Future tense to present tense , I could not find some straight forward way to do that .
So is it possible to break a sentence into and then re frame the sentence in present tense ?
Before :- It has been determined that in Year 2018, 1 new procedure code is to be added to Dental Related Groups
After :- Determine if in year 2018 , 1 new procedure code is added to dental Related Groups

Related

How to Split the value and find the longest text string in google sheet

I have a column in google sheet in which each cell contains this type of text
manager, finance manager
accountant
accountant, chief accountant
manager, auditor, other, finance manager
accountant
I want to find the longest text like below and show that text into new cell
finance manager
accountant
chief accountant
finance manager
accountant
I used split function to split the text and find function but finding character or number of character is working but i am unable to understand how i will get whole longest word
Kindly help me.
An alternative would be to use
=FILTER(TRIM(SPLIT(A1, ",")), LEN(SPLIT(A1, ",")) = MAX(LEN(SPLIT(A1, ","))))
and fill down as far as needed.
Suppose your comma-separated lists reside in A2:A. Place the following in, say, B2 of an otherwise empty range B2:B ...
=ArrayFormula(IF(A2:A="",,TRIM(REGEXEXTRACT(A2:A,"[^,]{"&REGEXEXTRACT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(REGEXMATCH(A2:A,"[^,]{"&SEQUENCE(1,30,30,-1)&"}")=FALSE,,SEQUENCE(1,30,30,-1))),,30))),"\S+")*1&"}"))))
This is a complex formula, one that would be difficult to explain. So I will leave it to you (and others who may be interested) to dissect, analyze and understand the inner workings. However, if there is a specific question I can answer should you (or others) get stuck, feel free to ask.
In short, the formula checks to see if there are any REGEX matches for non-comma groupings of 30 characters in length, then 29, 28 and so on to 1. If so, that number is returned in a space-separated list. The first number (which will be the highest) is returned and used to extract a non-comma REGEX expression of that exact length (which then has any leading or trailing spaces removed from it).
if your text is stored in column A, you can use this formula:
=hlookup(max(arrayformula(len(trim(split(A1,","))))), {arrayformula(len(trim(split(A1,","))));arrayformula(trim(split(A1,",")))},2,False)
Second option is to write a custom function.

Access 2013 Count

I am working on a report in Access 2013 I need to seperate the first 20 records in a column that contain a value and assign a name to them. Such as at 1-20 I need it to insert Lot 1 at 21-40 need to assign Lot 2 etc... The report needs to be separated by lots of 20. I can also just insert a line when it reaches sets of 20 without a name if that makes it easier. Just need something to show a break at sets of 20.
Example: As you can see the report is separated by welder stencil. When the count in the VT column reaches 20 I need to enter a line or some type of divider to separate data. What our client is asking for is we separate the VT in sets of 20. I don't know whats the easiest way to accomplish this. I have researched it but haven't found anything.
Example Report with Divisions
Update the report's RecordSource query by adding "Lot" values for each row. There are multiple ways of doing this, but the easiest will be if your records already have a sequential, continuous numerical key. If they do not have such a key, you can research generating such sequential numbers for your query, but it is beyond the scope of this question and no details about the actual data schema were supplied in the question.
Let's imagine that you have such a key column [Seq]. You use the modulo (mod) and/or integer division operators (\ - backslash) to determine values that are exactly divisible by 20, e.g. ([Seq] - 1) mod 20 == 0.
Generate a lot value for each row. An example SQL snippet: SELECT ("Lot " & (([Seq] - 1) \ 20)) As LotNumber ...
Utilize Access report sorting and grouping features --grouping on the new Lot field-- to print a line and/or label at the start of each group. You can also have the report start a new page at the beginning or end of such a group.
The details about grouping can be found elsewhere in tutorials and Access documentation and are beyond the scope of this question.

Extracting String in Parenthesis - SSIS

I have the following strings in a column called Qualifications:
D.Ther (ZIMB) 2017
D.Ther (ZIMB) 2016
Cert in Dental Therapy (ZIMB) 2017
D Tech (ZIMB) 1971
D Tech (The South African Dental Technicians Council -S.A) 1984
D Tech (ZIMB) 1987
Dental Technology (Natal-S.A) 1991
How do i retain the string in parentheses only using SSIS? for example ZIMB, Natal-S.A
I would approach this by identifying the location of the opening and closing parenthesis FINDSTRING. Knowing those two values, you can then use the SUBSTRING operation to extract the middle text.
Debugging is challenging with SSIS expressions. I would take the following approach. Add 3, yes 3, Derived Column Tasks to your data flow.
Derived Column 1
Add a new column called OpeningParenthesis of type DT_I4 (32 bit integer). The following expression will populate the value
FINDSTRING([Qualifications], "(", 1)
Find the first opening parenthesis in the column (case sensitive) Qualifications, starting at position 1.
Derived Column 2
Add a new called ClosingParenthesis of type DT_I4. The following expression will be used
FINDSTRING([Qualifications], ")", [OpeningParenthesis])
Find the first opening parenthesis in the column (case sensitive) Qualifications, starting at the location of the opening parenthesis.
Derived Column 3
Here we'll use a substring operation to slice out the middle text. Add a new column named Country and the type will be DT_WSTR. Use an expression like
SUBSTRING([Qualifications], [OpeningParenthesis], [ClosingParenthesis]-[OpeningParenthesis])
You might need to have a plus or minus 1 in that length calculation [ClosingParenthesis]-[OpeningParenthesis]
I don't have SSIS open at the moment so that's the approximate answer. Any of the positions from FINDSTR might be off by one but using this approach allows you to attach the Data Viewer between components to determine where things have gone wrong.
Also, depending on your data there might be issues if the column doesn't contain parenthesis or if it's null.
This is untested but should get you close.
substring -- parses a string with start point and how many chars
findstring will locate the position of the first value of the string searched.
substring([column], findstring([column],"(")+1,findstring([column],")") - findstring([column],"(")+1)
I finally got the right way as below:
SUBSTRING([Primary Qualifications],FINDSTRING([Primary Qualifications],"(",1) + 1,FINDSTRING([Primary Qualifications],")",1) - FINDSTRING([Primary Qualifications],"(",1) - 1)

SSRS: Filter 1 field based on 2 possible values in another field

I don't if I'm being a knucklehead, but I've searched considerably and tried several options: can't make it happen. Here is the issue.
I have the following Data Query:
First of all, sorry it's French. Secondly, as you see, the fields are "File number", the "Year" and the "Number of distinct patients".
Wanted result: I want to filter for Case numbers who appear both at 2015 and 2016.
As you see, certain patients showed up several years in a row. However, I want to find out how many showed up in 2015 AND 2016 only (not 2014, etc.) (so a total of 2 visits for the 2 years combined). So solely filtering in my Data Query on 2015 and 2016, doesn't do the job, since it fails to exclude the patients that only showed up once. Furthermore, filtering on 2015 and 2016, and then Count(Fields!File_number.Value)=2 wouldn't work since it fails to exclude the patients that might have been here in 2014.
I have tried several Boolean expressions, but as soon as I include 2 years in my filter, it blanks my tablix out. (Understandibly cause I tell it that Fields!Year.Value must be equal to 2015 and 2016 simultaneously).
So I tried bypassing it by telling it that and did the following:
Expression:
=IIF(Lookup(Fields!FileNumber.Value, Fields!FileNumber.Value, Fields!Year.Value, "Dataset")=2015 AND Lookup(Fields!FileNumber.Value, Fields!FileNumber.Value, Fields!Year.Value, "Dataset")=2016, True, False)
It works for 1 year only: as soon as I add 2015 either by and "AND" or by adding an additionnal filter, mytable goes blank.
Any suggestions? Thanks!
Yeah, this isn't an easy thing to solve, you aren't being a knucklehead :) You are correct about the double boolean expressions in the query and the two combined lookups won't work either. In the case of a lookup, LOOKUP returns the first match in a dataset, so every time, both of those looksups are going to return the first value.
There is another function called LookupSet which does return ALL matches from a query though. It should be possible to create an ugly expression around this function to test specifically whether the string 2015 and 2016 both appear in the results with something like:
=Join(LookupSet(Fields!FileNumber.Value, Fields!FileNumber.Value, Fields!Year.Value, "Dataset"),",")
and then substring searching for both "2015" and "2016" (I'll let you fiddle with that part)

Querying https://musicbrainz.org for all artists

How can I query for all artists who were born after 1720 and died before 1900 on https://musicbrainz.org?
I need to retrieve their IDs and some information about them.
Is it possible to get data in JSON format?
for those who dont want to read a long post, here is everything the OP asked for in only one query:
http://musicbrainz.org/ws/2/artist/?query=begin:[1720 TO 1900] AND end:[1720 TO 1900] AND type:"person"&fmt=json
This should return perfect results, and has got to be the best answer possible.
- all artists, born after 1720 and dead before 1900, in json format, which retrieves their IDs, and lots of information about them...
The explanation and thought process:
Since Brian's currently accepted answer includes a link to the API document, i can say it is technically complete but I don't consider pointing to the spec a the best possible answer, and can be greatly improved.
Firstly it is easy to return json by adding the json format parameter.
&fmt=json
Secondly while i don't reckon there where many boy bands back in the day, given that OP is asking about births and deaths we may conclude they are interested in only people rather than groups other types of artists.
AND type:"person"
At which point as Brian suggests another call for each end date and then filter the results taking only those who died by 1900.
If you did this you would need to do way more than 180 searches the best answer suggests, but rather one for each birth and each death year combination, so technically 1720 to 1720, all the way through 1900-1900, my math stinks but that is thousands of searches.
But what makes this still such a horrible search is because sometimes dates are either written with only the year, and then sometimes written with month date and year, so for example if you search for begin 1929 and end 1900
So if a date is written to include not only year but month/date you would not get any results for this artist because of the full birthday:
ex:
id "2b8a16a9-468f-49b0-93ea-5e6726f41643" type "Person" life-span
begin "1929-11-10"
end "1990"
ended true
Therefore in order to get any good results using only the year you would need to add the fuzzy search syntax
musicbrainz.org/ws/2/artist/?query=begin:1960~ AND end:1990~ AND
type:"person"&fmt=json
But this does nothing to solve big problem of the magnitude of searches suggested, so knowing its LUCENS based I decided to learn some LUCENS, and realize there is range syntax:
Therefor you can do all of the above with one query:
http://musicbrainz.org/ws/2/artist/?query=begin:[1720 TO 1900] AND
end:[1720 TO 1900] AND type:"person"&fmt=json
PS I recommend to start adding quotes or even url encoding your parameter values to prevent breakage.
For example leaving quotes off begin and end numerals in the example above has no problem but off the type value will fail.
First, Musicbrainz only returns XML, as far as I know, so you'll have to convert the results to JSON.
To answer your question, it doesn't look like you'll be able to get the data you want in a single call. (The following is based off the XML Web Service Search documentation.)
This call will retrieve all artists who were born in a given year:
http://musicbrainz.org/ws/2/artist/?query=begin:1720
I believe you'd need to write 180 calls (one for each year between 1720 and 1900) to get the data you need. You'd also need to manually filter out artists who died after 1900, by looking at the <end> node within <life-span>. This is because the end field will only get you artists who died in a specific year.