Why does Alloy-as-Markdown search for ModuleNameg.md rather than ModuleName.md given open ModuleName? - alloy

I have a .md file containing this fragment:
---
title: behaviour of vehicle locking system
layout: default
description: concrete example drawn from 2019 Ford Transit users handbook
---
```alloy
module VehicleLocking
open Vehicle
//etc
and the analyzer searches for Vehicleg.md rather than Vehicle.md. Why?

Related

(Mongoose) Get all items in database that have any fields (or all fields) that contain or are similar to search text

I have some data on books and want to perform a search on these JSON objects:
// all descriptions are from wiki, see footnotes.
{
title: "In Search of Lost Time",
author: "Marcel Proust",
description: "In Search of Lost Time follows the narrator's recollections of childhood and experiences into adulthood in the late 19th century and early 20th century high society France, while reflecting on the loss of time and lack of meaning in the world.", // from wikipedia, see footnotes
published: "1913" // date
}
{
title: "Ulysses",
author: "James Joyce",
description: "Ulysses chronicles the appointments and encounters of the itinerant Leopold Bloom in Dublin in the course of an ordinary day, 16 June 1904.[4][5] Ulysses is the Latinised name of Odysseus, the hero of Homer's epic poem the Odyssey, and the novel establishes a series of parallels between the poem and the novel, with structural correspondences between the characters and experiences of Bloom and Odysseus, Molly Bloom and Penelope, and Stephen Dedalus and Telemachus, in addition to events and themes of the early 20th-century context of modernism, Dublin, and Ireland's relationship to Britain.", // from wikipedia, see footnotes
published: "1922" // date
}
Let's say my search text is this: "marcel proust ullyses". I would like both items to be returned from MongoDB.
If, say I were to write "search of time recollections", I would like In Search of Lost time to be the only one that shows up, because in the description it has the word recollections and the title contains the words Search of (lost) Time.
If I had 2 items in the database of "In Search of Lost Time", but one was published 1913 and another was published 1927 and I searched for "In Search of Lost Time 1927" I would expect the latter to be returned. Is this possible?
Thanks

Can I add more data to snips-nlu on the fly?

I am using snips-nlu to create a "simple" chatbot for managing certain tasks. But I seem to lack the understanding of how (if possible) to add new intents on the go during runtime.
The issue I face is let's say I have the following in my yaml file:
type: intent
name: questionAboutFood
slots:
- name: foodType
entity: foodType
utterances:
- what color is a [foodType]
- where can I buy a [foodType]
---
type: entity
name: foodType
automatically_extensible: yes
values:
- banana
- apple
- orange
from this file I can fit it to my snips-nlu engine.
But How do I during runtime append more foodTypes?
CODE:
from snips_nlu import SnipsNLUEngine
from snips_nlu.default_configs import CONFIG_EN
import io
import json
seed = 42
engine = SnipsNLUEngine(config=CONFIG_EN, random_state=seed)
with io.open("dataset.json") as f:
dataset = json.load(f)
engine.fit(dataset)
parsing = self.engine.parse("what color is the apple?")
I can see two workarounds:
Re-train
One way to do that consists in dynamically re-training the engine with the dataset updated with the additional entity values. This may be a reasonable solution if your dataset is not too big, as the training will be quite fast.
Improve the dataset
The other solution consists in providing many more formulations of your intent in the yaml file, so that the resulting engine will be able to extract unseen entity values.
In your case, you only provided two formulations in which the entity is the last token. Besides, the entity values you provided are only unigrams. For these reasons, it is likely that the NLU engine will not be able to capture entities when they span several tokens and/or when they are located in the middle of the sentence.
Here is a slightly better dataset which will already generalize much better:
type: intent
name: questionAboutFood
slots:
- name: foodType
entity: foodType
utterances:
- what color is a [foodType]
- what is the color of an [foodType] in general
- how much does an [foodType] cost
- can you describe a [foodType] for me please
- in which country is [foodType] generally found
- where can I buy a [foodType]
- how big are [foodType] in average
---
type: entity
name: foodType
automatically_extensible: yes
values:
- banana
- apple
- orange
- red meat
- black eyed pea
- brussels sprouts

How to upload a file in node.js with multiple cateogries

I am new to node.js and trying to build an ebook store with node.js but I am not able to figure out how can I upload a book, that it can appear in multiple cateogires. For eg:- If I upload a book that is in spanish and is of physics. So, it should appear in two cateogries Spanish and physics.
I am completely new and struggling with node, If I need to learn anything new which can make development of book store easy please suggest it.
From my point of view. Upload your file first, Then add the created reference/path with your categories that will save some disk space.
-- Schema --
const bbookSchema = {
name: String,
category:[String],
file: String
}
-- Upload file first -- Get its URL --
then
{ name: "some book name", category: ["spanish", "physics"], file: "some-img/from/location"}
Save this format. It will save you a lot.

Splitting locale index.json into separate files?

I'm expanding a working Azure Bot Service prototype (on an App Service Plan) that contains all of its prompts in ./locale/en/index.json. Is it possible to split that into multiple files and programmatically determine which file we check for prompts at runtime? Would this cause significant unexpected performance impacts?
Example: if I had different responses to "what is an apple" and "what is an orange", defining both as fruitDefinition prompt in separate files (apple.json and orange.json.)
Instead of:
bot.dialog(('Apple', [
function (session, args, next) {
session.send("prompt_define_apple");
}
]).triggerAction({matches: 'Apple'});
This would allow me to be more generic with the code, pulling the same prompt name each time ("prompt_define") and just varying what file I take it from.
I could certainly keep dumping everything in the index.json but the prompt namespace is already getting a bit cluttered, and I'd like to scale this to a wide set of entities.
Thanks!
One way to achieve that is by using Libraries. By doing that you can have a localization file for each of the libraries.
In the Contoso Flowers sample, you will find this implemented.
To create the library (index.js)
bot.library(require('./dialogs/shop').createLibrary());
To define the library (shop.js)
var lib = new builder.Library('shop');
lib.dialog('/', [..]);
Localizable file (shop.json)
{
"default_user_name": "User",
"provide_delivery_address": "%s, please enter the delivery address for these flowers. Include apartment # if needed.",
"confirm_choice": "Great choice \"%s\"! Delivery on %s"
}

Highmaps svg path issue - Data not flowing into certain counties on US map

I've built an app using Highmaps.js, but I keep getting the following error message:
"Error: Invalid value for ..." then it gives a bunch of path coordinates that I'm not sure how to fix.
The result of this error is that none of the data for the states of Florida, Delaware or Connecticut show up. I'm guessing that it hasn't even been pushed into the map since noting happens when you hover over those states.
Do I need to make a new svg? Can I edit the path of the old one or fix the current one somehow?
Any advice would be much appreciated!
Here's the prototype of the site:
www.graysonmendenhall.com/PAN2014
You have some name mismatches between your map SVG Paths and your data. For instance, in your map you'll have:
{
"name": "Levy County, FL",
"path": "M2393,1490L2409,1493L2412,1511L2404,1513L2406,1524L2406,1524L2405,1525L2401,1527L2397,1527L2396,1527L2395,1527L2394,1528L2393,1529L2393,1530L2393,1527L2392,1526L2389,1520L2387,1519L2365,1513L2370,1509L2373,1504L2374,1499L2376,1490L2393,1490"
},
But in the data it's:
{
name: "Levy, FL" // No County!!
value: 3218
}

Resources