For ConceptMapper: How do I include an ampersand in the canonical attribute? Or do I need to expand it to a word equivalent? - uima

I need to have entries like this:
token canonical="Dow Jones & Company, Inc." POS="NNP" SemClass="property">/token>
in my dictionary.
I tried:
token canonical="Dow Jones (&)amp; Company, Inc." POS="NNP" SemClass="property">/token>
without the parentheses, but I get the standard "The entity name must immediately follow the '&' in the entity reference." as if it does not recognize the "amp;"

I ended up adding the special characters I needed to a list of StopWords. Works well.

Related

Getting the user's name without directly asking for it (Watson Assistant)

I'm creating a chatbot for fun and want to implement something to collect the user's name, but only if he says something like "my name is ..." or close to that; the intention of giving the name would come from the user, the bot won't ask for it, maybe only suggest it. Kind of like in Google Assistant, I think. So, it could be given at any time the user wants.
My idea is:
1st create an intent with different ways the user would tell his name to the bot (like in the example above).
2nd use slots and, if the intent is detected, save it as a variable. So far, I've managed.
3rd is the part that I'm stuck in, since it's only an idea and I don't know how I'd do it. Before saving the whole text as a variable, I'd like to delete the part that's included in the intent (my name is) and save only the rest in the variable. So, for example, the user says "my name is XXX"; the command deletes the "my name is" part and saves only "XXX" in the $name intent.
I don't know if this'd be possible, since I don't know coding. I used some special syntax before, like to capitalize the first letter of some other variable, but I don't really know how to use the JSON editor.
Is my idea viable? I don't know how I'd delete the intent corresponding portion and save only the remaining part as the intent. Dunno what would be the command for that, nor where I'd write it.
You can suggest something else if you have an idea.
Last thing, I'm created the skill in portuguese, so there's no access to the #sys-person entity.
Thanks for reading.
I use portuguese skills and face the same issue. I see two solutions, althougt they are not perfect:
Using intents:
When the intent is identified, the bot asks the name again, telling the user that he should only say his name, e.g without "my name is", then store the whole input on a context variable, using:
<? input.text ?>
For embedding such logic inside slots, you probaly will need to use digressions.
But, this is boring to the user.
Using entities:
Entities identification carries along they start and end position in the input text, but intents not. With this, is possible to slice the input, cutting the entity:
<? input.text.substring(entities.name.location[1], input.text.length()) ?>
Entites would be "My name is", "People call me", "I'm called", "I'm baptized", "I was baptized".
So, "Hello, my name is Gustavo", would be cut after "my name is" ending, resulting in "Gustavo". Additional input in the beggining is ignored, but problems arrise with additional input after the name. Also, you need to define more "my name is" like entities, likely all possibilities, than would need if using intents, cause even with fuzzy matching, entities identification doesn't take in account synonymus and similar meaning words.
https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methods#dialog-methods-strings-substring
https://cloud.ibm.com/docs/assistant?topic=assistant-expression-language#expression-language-access-entity

"The expression is not valid" when performing SharePoint Rest call

I have a SharePoint site and when I call
SITE/_api/web/lists/
it gives me the data for all the lists no problem. The problem is once I start querying for a specific list (for example one called "Environments") by calling
SITE/_api/web/lists/getbytitle("Environments")/
it gives me the error
Microsoft.SharePoint.Client.InvalidClientQueryExceptionThe expression "web/lists/getbytitle(Environments)/items" is not valid.
Am I not building the URL right or is there something wrong with the site.
Use apostrophes (') instead of quotation marks around the title of your list.
If your list tile has apostrophes in its title, you need to escape those by replacing each apostrophe with %27%27.
Correct REST URL to get list items is :
http://site url/_api/web/lists/GetByTitle('Test')/items
You are missing single quotes around List name.
Check MSDN : https://msdn.microsoft.com/en-us/library/office/dn292552.aspx

PowerShell retrieve and sort EmailAddresses

I'm using the below code for retrieving and simultaneously adding a separator "," for each smtp-attribute in the EmailAddresses-property.
get-mailbox | select-object DisplayName,PrimarySMTPAddress, #{Name='EmailAddresses';Expression={[string]::join(", ", ($_.EmailAddresses))}}
But I would also like to sort the values of EmailAddressess so that uppercase always comes first by using powershell and with as little effort (short code) as possible.
If you're not familiar with Microsoft Exchange: each value inside EmailAddresses first starts with smtp: or SMTP: followed by the users various email addresses. uppercase SMTP means its the primary SMTP-address used when sending an email for example. Lowercase smtp means its just another email address.
I'd like to sort the output so that the SMTP:*-value comes first.
Bonus question, in the Expression-block; can multiple [string]:: overloads be used together, if so how?
I was attempting to achieve a sorted output by using [string]::OrderBy() and [string]::OrderByDescending() but I couldn't figure out how to use them together with [string]::split().
Thanks to user 4c74356b41, I now realize that my string doesn't contain OrderBy() or OrderByDescending() hence they cannot be used.
MSDN: OrderBy Method
MSDN: OrderbyDescending Method
You can just nest a pipeline sort inside of your expression.
#{Name='EmailAddresses';Expression={[string]::join(", ", ($_.EmailAddresses | Sort-Object))}}
99% sure this will work for you but didn't mock up a full test to be sure so let me know if it fails.

Word 2010 can Field added via QuickParts be given an ID and later referenced in document.Fields collection

I need to add a few fields to a Word 2010 DOTX template which are to be populated automatically with custom content at "run time" when the document is opened in a C# program using Word Interop services. I don't see any way to assign a unique name to "Ask" or "Fill-In" fields when adding them to the template via the QuickParts ribbon-menu option.
When I iterate the document.Fields collection in the C# program, I must know which field I'm referencing, so it can be assigned the correct value.
It seems things have changed between previous versions of Word and Word 2010. So, if you answer please make sure your answer applies to 2010. Don't assume that what used to work in previous versions works in 2010. Much appreciated, since I rarely work with Word and feel like a dolt when trying to figure out the ribbon menuing in 2010.
You are correct in that fields don't necessarily have a built-in way to uniquely distinguish themselves from other field instances (other than its index in the Fields collection). However, you can use the Field.Type property to test for wdFieldAsk or wdFieldFillIn . If this is not narrow enough to ID then you will need to parse your own unique identifier from the Field.Code. For example, you can construct your FILLIN field as:
{ FILLIN "Hello, World!" MYIDENTIFER }
when you iterate through your document.Fields collection just have a test for the identifier being in the string. EDIT: example:
For Each fld In ActiveDocument.Fields
If InStr("CARMODEL", fld.Code) <> 0 Then
''this is the carmodel field
End If
Next
Another alternative - seek your specific field with a Find.Text for "^d MYIDENTIFIER" (where ^d is expression for 'field code')
Let me know if this helps and expand on your question if any gaps.

Problem while using NSPredicate

Sql query:
select * from test_mart
where replace(replace(replace(replace(replace(replace(lower(name),'+'),'_'),'the '),' the'),'a '),' a')='tariq'
I can fire following query very easy, if I have to use simply Sqlite... but In current project I am using Core Data so not familiar about NSPredicate much.
The functionality talks about removing all BUT alphanumeric characters, which means removing special characters.
The characters that should be valid in the comparison would be
ABCDEFGHIJKLMNOPQRESTUVWXYZ1234567890
But we should not fail the comparison for the following characters
:;,~`!##$%^&*()_-+="'/?.>,<|\
Or for the following words
'the' 'an' 'a'
Some examples:
'Walmart' would be seen as the same payee as 'Wal-Mart'
'The Shoe Store' would be seen as the same payee as 'Shoe Store'
'Domino's Pizza' would be seen as the same payee as 'Dominos Pizza'
'Test Payee;' would be seen as the same payee as 'Test Payee'
Can any one suggest appropriate Predicates/Regular Expression ?
Thanks
I would have an extra field in the data base which would be a processed version of the original with all the irrelevant characters stripped out. Then use that for comparisons.
You might want to look at the soundex algorithm which may suite your purposes better... Soundex
It seems to me that you would want to normalize your data before it every gets set into the core data store. So if you're given "Wal-Mart", normalize it to "walmart" once, and then save it. Then you won't be doing all of this expensive on-the-fly comparison many many times.
The normalization would be fairly simple, given your rules:
Strip the words "a", "an", and "the"
Remove punctuation