Currently, Object2Vec supports these comparators: "hadamard, concat, abs_diff". I am trying to build a user-item recommendation system. I am wondering which comparator to pick for this particular use case. I would love to learn more about the effect of comparators in general.
Related
i want to make a rasa based chatbot with at least two languages or multi lingual chatbot. Can anybody tell me possible way of making it.
Nice question. (And this is something I'm working on too.)
The good thing about the embedding intent classifier is that it doesn't have any assumptions about what language it works on. So, in theory, it should work with every language.
There are 2 approaches that you can use to support multi-language intents.
1. make separate intents for them (e.g. hello_en, hello_xx, for hello spoken in 2 languages)
2. create a language detector and handle them all in custom action
If you're using default utter_ methods, method 1 may make more sense becuase you can just use hello_en as intent name and utter_hello_en to get back the response.
Method 2 makes more sense when you actually have multiple variables that you want to use to generate your response (and of course, you handle them in custom actions).
All in all, you can implement multi-language chatbots in rasa!
Edit:
What you want is a custom language detector that finds out which language you're using. You can include the language-detector as a custom component in the beginning of your pipeline and make it fill a language slot. Then, you can use this slot value as input in your custom actions and respond accordingly.
I'm trying to inline-bind my functions using this kind of syntax:
onChange = () => {
}
However, my sublime editor isn't correctly highlighting it:
I'm using the Babel package for sublime for syntax highlighting.
Does anyone know how to make it recognize this sort of style?
Check this
View -> Syntax -> Open all with current extension as... -> Babel -> Javascript(Babel).
or
Ctrl - Shift - P, type "Babel" and select Set Syntax: Javascript(Babel)
Source
ST3 relies on language definitions for providing language features such as code folding, syntax highlighting etc. However, with JavaScript, you have many different flavors of the language - like ES5, ES6, JSX etc. To correctly understand and parse each one of them is not easy given ST3's design (using a language definition file which is mostly regex matching).
So depending on what you're looking for, you may want to install JavaScriptNext - ES6 Syntax which helps ST3 better understand the language and its syntax. There are few others like these on marketplace if I'm not mistaken.
Then comes the notion of syntax highlighting - again, without the core editor natively understanding what's JS and what's JS-like out, these plugins are dependent on how good the language definitions are and so, have one or more shortcomings. There are a few options that you can try and see what suits best:
naomi - Enhanced syntax definitions for Sublime Text 3. Supports stage-0 features
babel-sublime - Syntax definitions for ES6 JavaScript with React JSX extensions. But has some issues with arrow functions, see #301
sublime-react - It's actually deprecated in favor of babel-sublime but you may want to check it out.
Whatever you choose, you need to do some due diligence. Check with their issue lists, see if anything stands out to you. Relying on transpilers can only go so far.
As a long time ST3 user, I've constantly found one or more issues. And depending on whether you're working on pure JS, or React, you may have to keep switching or accept some compromises.
Ultimately, I switched to VSCode (tried Atom too) which understand the language and it's flavors natively and provides extensions API that authors can build upon. Consequently, the syntax understanding and highlighting capabilities are far greater than what you can get out of ST3 + Extensions.
The only solution that comes to mind is to create a custom snippet, for Sublime, to "recognize" the arrow function or in general the reduced syntax to declare a function.
Here are two links that could be useful:
https://medium.freecodecamp.org/a-guide-to-preserving-your-wrists-with-sublime-text-snippets-7541662a53f2
and
https://gist.github.com/LeZuse/2324352
or
https://gist.github.com/ZYinMD/860926a178ccd6d107ffe2c6727b5845
I've been taking a look at ReasonML (https://reasonml.github.io/) and in general, as a 'loyal' ;) functional programmer, I like the idea. However, I believe there's a missing part in my reasoning about the project.
In particular I'm a bit confused if it comes what to search for. For example, I'd like to build a simple web server. Shall I use JS-related libraries (express, ...), OCaml technologies, or maybe yet something else ?
What I'm actually missing is a step-by-step guide that presents a way to build a full basic application (in this case: let's say a simple web server with db connection).
Last thing - forgive me imprecise language. As I said: I'm pretty sure there's a gap in my reasoning about ReasonML and I'd like to fill it ;).
If you want to write portable code, you should use the OCaml technologies, so Array.length (from OCaml core) instead of Js.Array.length (Bucklescript JS wrapper).
If you do not care about native code, but just want to target JS (node/browser), then you can use the FFI and leverage your existing knowledge of JS libraries.
IMHO, this FFI is one of the nicer things of reasonML. The resulting code is small and you can inspect the .bs.js files to see what it's doing.
But as said, you lose the ability to generate native code this way.
Here is an example,
https://github.com/wires/reason-ffi
Say I don't have a range function in OCaml or ReasonML and I don't want to write one, but I know ramda has one. Just write some JS,
// range.js
exports.range = require('ramda').range
Then wrap it with types, like
[#bs.module "./range.js"] external range' : (int,int) => array(int) = "range";
let range : (int,int) => list(int) = (a,b) => range'(a,b) |> Array.to_list
I'm not saying this is the ultimate way to use this tool, but I find it a very frictionless way to transition untyped garbage JS to something reasonably maintainable.
And you can leverage your existing JS library knowledge and keep building with reasonML, instead of spending your time writing a boring range function (which is also learning... of course)
Is there a such thing as a preprocessor whose statements, once processed, disappear completely and get replaced by the target language syntax permanently?
I want to research it on the web but I don't know what term to search for. If I search for "code generator", "templating language", "preprocessor directives", "mixins", "annotations" I get generators whose input becomes the source of truth.
The closest thing I can think of is a macro.
What I'm trying to do
I often have to write code that is verbose and unnecessary manual labor and am looking for a smarter way to input at least the majority of it and have it automatically transformed and only source-control the output (and hand edit if necessary). For example:
Java code - Instead of writing getters/setters, javadoc (perhaps the transformer can be a maven plugin)
HTML - I just want to add URLs, and have my preprocessor automatically convert them to links, images, videos, audio etc. depending on the file extension with some regex substitution (currently I run a perl script via a cron job)
I just want to use it as my own shorthand and not enforce it in my project and make the output editable so that others have to learn a new framework or language (like Protobuf, Stringtemplate, GWT, C hash-defines, PHP, JSP etc).
There should be no direct clue that I used a template/preprocessor to generate it.
What you want is a "program transformation system". See https://en.wikipedia.org/wiki/Program_transformation. (This is a superset of "transpilers" [ugly term]).
A good source-to-source transformation system will let you apply rewrite rules of the form of:
if you see *this*, replace it by *that* if *this_condition*.
You can then take your source code, and run a set of rewrite rules across that code to change it.
The resulting code is "transformed"; the rewrite rules are not visible.
It seems like Transpiler is one way to describe it.
Do Hacklang Collections have higher order functions such as Reduce, Some, All or an easy way to implement such methods. The Collection I am most focused on is the Vector. It seems to only have Map and Filter. The others would help in writing more clean looking functional code.
Full information on the different Hack collections is best seen on the API docs for Vector (and other classes).
I also only see ->map and ->filter, though writing a utility function to do reduce yourself isn't particularly difficult, of course.