How to get luis.ai model as json - azure-language-understanding

I'm currently wading through some of Microsoft's open-sourced packages for Luis.ai. I'm particularly looking at their botbuilder package.
This package has a model generator which can be found here.
The generator takes the JSON of the Luis.ai model you've built, the problem I'm having is finding that JSON.
Is there somewhere I can grab the JSON model so I can paste it into this generator?

This is how to use LuisGen (the model generator you have linked):
Clone the LuisGen. Make sure you have .Net 2.1 SDK installed. Open "tools.sln" inside packages folder with Visual studio and build it. Now go to "Tools" > "Nuget Package Manager" > "Package Manager Console". It will open at the bottom, type and enter "dotnet tool install -g LUISGen" It will install LUISGen which you will need to use in step 3
To get the JSON file it's somewhat hidden. Go to the Luis.ai. There are two ways, either
Go To "My Apps" at the top, select tickbox for the app you need then "Export" then "Export as JSON".
other way is "Manage" Tab next to Build. Then "Version", then again you need to select the checkbox (for a version) then export > export as JSON.
Go to the location of the JSON file. Hold Shift and right click, select "Open PowerShell Here". Now type "LUISGen {Name-of-json-file}.json -cs {Desired-Name-for-CS-file}" without quotes and replace braces with the json file name and the filename you want for the C# Model file

You create your model at LUIS.ai. Once your model has been constructed, trained, and published you can export it locally whereby you can use it via CLI in other projects/tools, such as LUISGen. As it states, LUISGen "generates source code from an exported LUIS model".
Alternatively, you can use the LUIS cli (which you referenced/linked) to construct your model, if using command lines is more your thing.
Hope of help!

Related

How to create package file similar to Logic or Final Cut project

I am trying to create a file in OS X that is essentially a package that has files in it, similar to how a Logic project is a single file but contains all of the audio files within it (when you right-click the file it has the "Show Package Contents" option).
Doing this in Swift would be great, but also curious just in general how this is done? I haven't had much luck.
You need to define a "Document Package" type. Basically these "packages" are just a directory with a file extension applied that tells macOS to display them as a package. As long as you setup the type in your applications Info.plist then you shouldn't need any special API's to create the packages (though apple does have some helper APIs if you want to use them).
For complete documentation on defining a new "Document Package" type and some links to some helper API's see: https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/DocumentPackages/DocumentPackages.html

How do I edit snippets in Sublime Text 3?

In Sublime Text 3, how do I edit my pre-existing snippet files? Is there a way of doing this within ST?
At the time of writing, there doesn't seem to be a straightforward answer to this anywhere on the web.
Custom snippets are saved in a .sublime-snippet file that you create when you first save the snippet.
By default, these are placed in the "User" package. You can either browse to the file like you would any other file, or using PackageResourceViewer: Open Resource -> User -> [name of your snippet file]
For those of you that like a visual instruction here it is:
Then, you can find your snippet like this:
If someone (like me) is looking to edit a custom snippet:
open file *.sublime-snippet which exists in
[home_directory]/.config/sublime-text-3/Packages/User/
If you have another file organization:
Start to make new snippet - Tools->developer->new snippet
Try to save it. Sublime shows you the right directory with snippets
Tools -> Developer -> View package file -> search for the existing snippet.
Change and save.
Here are the steps I had to follow (figure out on my own) for anyone else who wants to edit the built-in snippets of Sublime (in my case Javascript's "fun" "function" snippet). Note: this assumes you've installed the Package "PackageResourceViewer" already:
--> PackageResourceViewer: Extract Package
Then specify which package(s) you want to extract. FWIW this process was a bit confusing for me ... somehow I managed to select everything? but I only wanted/needed "JavaScript".
Wait a second or three for Sublime to extract these (no idea what this does in background, I assume maybe unzipping/extracting loose files to your file system?)
You'll get a confirmation dialog about your successful extraction
NOW you can edit built-in snippets by --> PackageResourceViewer: Open Resource
--> Select "JavaScript" (in my case)
--> Select "/Snippets" (in my case)
--> Select your snippet (in my case it was "function-(fun).sublime-snippet" or something like that.
The file will open and you can modify/save your changes ... FINALLY!
WAY too complicated IMHO but at least it works.
Here is how to edit built-in snippets manually on macOS, in this case the JavaScript snippets. This is a way to do it without installing plugins:
Right click the Sublime Text app, select "Show Package Contents"
In the Finder, navigate to Contents -> MacOS -> Packages
Copy the JavaScript.sublime-package file to ~/Library/Application Support/Sublime Text 3/Installed Packages
Change the file name from JavaScript.sublime-package to JavaScript.zip and unzip the file
In your text editor, edit the contents of the unzipped JavaScript folder as required (e.g. delete the fun snippet from the Snippets folder)
Zip up the JavaScript folder again, rename it from JavaScript.zip to JavaScript.sublime-package and leave it in the Installed Packages folder.
Restart Sublime. Your new JavaScript package will override the built-in package.

How do I configure TortoiseHg to open a file in the right program based on its extension?

I'm using TortoiseHg v2.2.1 with Mercurial 1.9 in WindowsXP. How do I configure TortoiseHg to view a file based on the application Windows has associated with its extension?
For example, if I have a .docx file in the repository and I'm looking at its revision history, I'd like View at revision... to open the selected revision in MS Word. Likewise for other binary file types like ppt and xls, which I can't view using the default text editor or kdiff3.
Can I leverage that Windows already knows what program to use to open certain types of files or will I have to manually configure each file type of interest within the Tortoise config files?
I've found several SVN scripts in the TortoiseHg\diff-scripts folder that look like they solve a similar problem for diffing binaries rather than simply viewing them, but those don't seem to be activated and I'm not sure what if anything I need to mod in the MergePatterns.rc or Mercurial.ini files to make this all work.
To make "View at Revision" use whatever program is associated with the file's extension, try this trick: In the "Global Settings" in the "TortoiseHg" section, enter start "" as "Visual Editor". Note the empty "". This is necessary so that start will not use the file name, which gets passed in quotes by TortoiseHg, as the window title.

A way to automatically organize #imports in Xcode

I love the "Organize Imports" command in Eclipse to implicitly add and remove classes imported into a source file (as in Java or ActionScript).
Is there a command in Xcode to update the #import directives at the top of.m Objective-C files based on the classes referenced within the file?
You can do this by creating an Automator action and use that in Xcode as well as everywhere in Mac OS X. To do that, do the following:
Start Automator -> New
Choose "Quick Action" (or "Service" on older MacOS/Automator versions)
add a "run shell script" action
use sort | uniq as the script and check the "output replaces selected text" checkbox
save and give it a name (e.g. "sort & unique")
check "Output replaces selected text"
After you saved it, you can just select your imports in Xcode, right click and choose your "sort & unique" action to organize your imports.
This is not as good as the organize import actions in Eclipse or IntelliJ, because it doesn't removes unused stuff etc. but it's better than nothing.
PS: Got that from WWDC 2012 Sessions - Session 402 Working Effeciently with Xcode (starting at 6:15)
EDIT
I started using AppCode, the Objective-C IDE from JetBrains, and it has features like "organise imports". You should check it out: http://www.jetbrains.com/objc/.
I'm resolving this as not currently a feature of Xcode :(
I've found Cedar Shortcuts to at least be usable. It's not as good as Eclipse's import feature (it doesn't organize imports), but it can keep you from having to go to the top of a class file and typing an import statement. With this plugin you just place the cursor on the class that needs imported and press Ctrl + Option + I. Here's the github project. https://github.com/cppforlife/CedarShortcuts
I made a small Xcode plugin to sort the headers and remove duplicates of the file with a shortcut, you can check it out! - https://github.com/insanoid/CleanHeaders-Xcode
AppCode from Jetbrains can do this.
Yup. Like in Eclipse, this would be an awesome feature since developing in XCode (Cocoa Touch) does require quite a bit of class imports which are not easy to remember and Android development in Eclipse sorts this out with a simple keystroke combination that saves so much time ! Hope there is a way to do this in XCode soon !
WordService (freeware) from Devon Technologies, provides a service that can be used in any Cocoa app that can (amongst others) sort lines.
Alternatively, you can use an Xcode Extension, such as Imp
Swiftlint has an opt-in rule which if opted, will automatically sort the imports alphabetically.
Add - sorted_imports to your .swiftlint.yml file under opt_in_rules.
Run swiftlint autocorrect terminal command on project root directory (same where swiftlint.yml is stored).

creating .lib file in Visual Studio

I feel like an idiot asking such a basic question but for the life of me, I can't find much on this topic.
Anyway, how does one go about making a .lib file using Visual Studio (or whatever tool)?
Let's say I have a project or work space with one .cpp file and .obj in it.
TIA, Mike
Go to Project->Properties. Under "General" set "Configuration Type" to "Static Library (.lib)". Then under "Linker" change the extension of the Output File to .lib . Then you're good to go. Remember to do these for all your configurations (Debug, Release etc.)
To create a new static library project
From the File menu, select New and then Project….
On the Project types pane, under Visual C++, select Win32.
On the Templates pane, select Win32 Console Application.
Choose a name for the project, such as MathFuncsLib, and enter it in the Name field.
Choose a name for the solution, such as StaticLibrary, and enter it in the Solution Name field.
Press OK to start the Win32 application wizard. On the Overview page of the Win32 Application Wizard dialog box, press Next.
On the Application Settings page of the Win32 Application Wizard, under Application type, select Static library.
On the Application Settings page of the Win32 Application Wizard, under Additional options, clear the Precompiled header check box.
Press Finish to create the project.
See here for more details.
Go into proprties->Configuration Properties->General->Configuration type.
There you want to choose static library (.lib).
Then you just have to build it.
look at the project properties. There will be one that says something like output type, you just choose library, as opposed to .exe.

Resources