WhereIsAI/github-issue-similarity huggingface dataset:
Issue 1:
Multi-field is great, but searching with multiple analyzers against only one field is simpler/better.

If you have a multi-lingual index, where each document has its source language, you can analyze the text fields using a special analyzer, based on the detected language (maybe even using the _analyzer.path functionality).

But what happens when you misdetected the language somehow, either at index- or at query-time? Some aggressive stemming can have devastating effects.

In such a scenario, having the original words indexed in parallel to the stemmed one would help. Be they in the same field would even letting phrase/slop queries work properly.

The only way to get multiple terms at the same position with ElasticSearch is through the synonym token filter, useless for stemming.

I've been working on a way to merge the terms that multiple analyzers output.

Say you want both to use a simple analyzer, and any of the specialized language-specific analyzer, or anything.

My plugin can make it as simple as the following index setting:

index:
analysis:
analyzer:
# An analyzer using both the "simple" analyzer and the sophisticated "english" analyzer, combining the resulting terms
combo_en:
type: combo
sub_analyzers: [simple, english]

Here is a simple example of what is does:

# What the "simple" analyzer outputs
curl -XGET 'localhost:9200/yakaz/_analyze?pretty=1&analyzer=simple' -d 'An example'
{
"tokens" : [ {
"token" : "an",
"start_offset" : 0,
"end_offset" : 2,
"type" : "word",
"position" : 1
}, {
"token" : "example",
"start_offset" : 3,
"end_offset" : 10,
"type" : "word",
"position" : 2
} ]
}
# What the "english" analyzer outputs
curl -XGET 'localhost:9200/yakaz/_analyze?pretty=1&analyzer=english' -d 'An example'
{
"tokens" : [ {
"token" : "exampl",
"start_offset" : 3,
"end_offset" : 10,
"type" : "<ALPHANUM>",
"position" : 2
} ]
}

# Now what our combined analyzer outputs
curl -XGET 'localhost:9200/yakaz/_analyze?pretty=1&analyzer=combo_en' -d 'An example'
{
"tokens" : [ {
"token" : "an",
"start_offset" : 0,
"end_offset" : 2,
"type" : "word",
"position" : 1
}, {
"token" : "example",
"start_offset" : 3,
"end_offset" : 10,
"type" : "word",
"position" : 2
}, {
"token" : "exampl",
"start_offset" : 3,
"end_offset" : 10,
"type" : "<ALPHANUM>",
"position" : 2
} ]
}

Terms are sorted by position, then by start/end offset, so that it's easier to use its output under reasonable assumptions of using a classical analyzer.

Here is the good news! You can find my implementation here: https://github.com/ofavre/elasticsearch/tree/combo-analyzer-v0.16.4 (based on released ElasticSearch version 0.16.4).

EDIT: It is finally available as a plugin, thanks to jprante: https://github.com/yakaz/elasticsearch-analysis-combo.

Issue 2:
Describe the feature:

close inactive index(without read or write) for configable time.

when it is visited first time, open it.
Issue 1:
TypeScript compiler hangs for me and does not complete compilation within 5 minutes on a 50 KB source file. To reproduce, run on this input file:

https://raw.githubusercontent.com/Tachyus/gluon/master/src/Gluon.Client/Gluon.ts

Platform: Windows 10 64-bit

tsc --version
message TS6029: Version 1.7.3

node --version
v5.2.0

Issue 2:
This is the same code as what originally prompted #2997

While it isn't crashing because of infinite loops any more, it has become very slow with 1.7. If I pause it in the debugger I see the following stack repeating many times.

inferFromTypes [tsc.js] Line 15334 JavaScript
inferFromTypes [tsc.js] Line 15314 JavaScript
inferFromTypes [tsc.js] Line 15301 JavaScript
inferFromProperties [tsc.js] Line 15350 JavaScript
inferFromTypes [tsc.js] Line 15334 JavaScript
inferFromTypes [tsc.js] Line 15314 JavaScript
inferFromTypes [tsc.js] Line 15301 JavaScript
inferFromIndexTypes [tsc.js] Line 15380 JavaScript
inferFromTypes [tsc.js] Line 15337 JavaScript
inferFromProperties [tsc.js] Line 15350 JavaScript

Reduced test case:

class Module {
public members: { [name: string]: FFunction | Property };
}

class Namespace {
public members: { [name: string]: Class | Enum };
}

class Class {
public parent: Module | Namespace;

public members: { [name: string]: Property | FFunction };
}

class Interface {
public members: { [name: string]: Property | FFunction };
}

class FFunction {
public parent: Module | Namespace | Class | Interface; // (1)
}

class Property {
public parent: Module | Namespace | Class | Interface; // (2)
}

class Enum {
public parent: Module | Namespace;

public members: EnumMember[];
}

class EnumMember {
public parent: Enum;
}

var members: (Property | FFunction)[];
members.map(member => "");

Compile with tsc foo.ts on node 4.2.2 x64 on Windows 7.

This takes ~18s on my machine. If I remove Module from the union type at (1), it drops to ~12s. Removing Module at (2) drops it to ~6s. And so on.

The original code is at https://github.com/Arnavion/libjass/blob/82f3706/build/typescript/ast.ts which has a much more complicated forest of types. It's been compiling for 5 minutes now, whereas it took ~2s with 1.6
Issue 1:
When a type's __eq__ (or tp_richcompare in C) doesn't understand the other type, it should return NotImplemented so that the other type's __eq__ has a chance to be called. Unfortunately, NumPy's ArrayDesrc doesn't respect that convention and raises TypeError instead, making comparisons fragile:

>>> import numpy as np
>>> class A(object):
... def __eq__(self, other):
... return True
...
>>> dt = np.dtype('i8')
>>> A() == dt
True
>>> dt == A()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: data type not understood

It is generally considered bad practice to raise TypeError in a comparison method, and can prevent advanced uses: such as defining a custom type comparable with ArrayDescr, or simply mixing ArrayDescr with other types in e.g. a dictionary.

Indeed let's say I use the standard lru_cache, then hash collisions can produce unwanted errors because of the dictionary used internally comparing the keys:

>>> @functools.lru_cache()
... def f(x): return str(x)
...
>>>
>>> class A(object):
... def __hash__(self):
... return hash(dt)
...
>>> f(dt)
'int64'
>>> f(A())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/antoine/34/lib/python3.4/functools.py", line 446, in wrapper
link = cache_get(key)
TypeError: data type not understood

Issue 2:
Summary

Make DType objects, their corresponding types, and their string names all compare unequal.

Historical issue

For some reason, dtype objects and the numpy types they are based off of compare equal. They don't hash equal of course, which goes against Python's docs that say

The only required property is that objects which compare equal have the same hash value…

Can we make them compare unequal? Is there any reason for them to compare equal?

In [6]: np.dtype(np.float) == np.float
Out[6]: True
Issue 1:
While fixing some project for latest rust nightly (porting to new IO) I got an misleading error because I used a Path in an enum that was used in a vector as function argument.

use std::path::Path;

enum SomeEnum {
SomeBool(bool),
SomePath(Path)
}

fn some_function(arg: &mut Vec<SomeEnum>) {
/* some whitespace to demonstrate that the line number is also wrong

*/
}

fn main() {
let mut v = Vec::new();
some_function(&mut v);
}

<anon>:8:1: 17:2 error: the trait `core::marker::Sized` is not implemented for the type `[u8]` [E0277]
<anon>:8 fn some_function(arg: &mut Vec<SomeEnum>) {
<anon>:9 /* some whitespace to demonstrate that the line number is also wrong
<anon>:10
<anon>:11
<anon>:12
<anon>:13
...
<anon>:8:1: 17:2 note: `[u8]` does not have a constant size known at compile-time
<anon>:8 fn some_function(arg: &mut Vec<SomeEnum>) {
<anon>:9 /* some whitespace to demonstrate that the line number is also wrong
<anon>:10
<anon>:11
<anon>:12
<anon>:13
...
error: aborting due to previous error

The error complains about a [u8] but there is no [u8] in the signature. Also the line number of the error message points to the closing bracket of the function but then goes on and prints the first lines of the function.

Error was easily solved by replacing Path with PathBuf once it became clear that Path is the culprit.

http://is.gd/yD8S6w

Issue 2:
use std::path::Path;

fn f(p: Path) { }

produces

foo.rs:3:6: 3:7 error: the trait `core::marker::Sized` is not implemented for the type `[u8]` [E0277]
foo.rs:3 fn f(p: Path) { }
^
foo.rs:3:6: 3:7 note: `[u8]` does not have a constant size known at compile-time
foo.rs:3 fn f(p: Path) { }
^

We should give an explicit hint that Path should be passed by reference. Also the error does not mention Path and the type u8 does not appear in the program.

UPDATE: The message now includes a full stack trace of types, but it would be better to start out with the type the user knows about (Path, in this case) and only discuss [u8] last. -- @nikomatsakis
Issue 1:
It might be better in the long term to allow this function to run from anywhere within the deno directory. Something like this would work but depend on there being one parent being named deno:

pub fn ts_version() -> String {
let mut manifest_dir =
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap());
let deno_root = Some(OsStr::new("deno"));
while manifest_dir.file_name() != deno_root && manifest_dir.pop() {}
manifest_dir.push("cli/tsc/00_typescript.js");
std::fs::read_to_string(manifest_dir.into_os_string().to_str().unwrap())
.unwrap()
.lines()
.find(|l| l.contains("ts.version = "))
.expect(
"Failed to find the pattern `ts.version = ` in typescript source code",
)
.chars()
.skip_while(|c| !char::is_numeric(*c))
.take_while(|c| *c != '"')
.collect::<String>()
}

Issue 2:
Hey community,

I presume it would be nice to have an option flag to deno run to tell that one wants to parse the file as TypeScript even though it doesn't have a .ts extension.

Consider this CLI shebang executable script, named hello.ts and hello:

#!/usr/bin/env -S deno run

let s: string = "Hello world"
console.log(s)

Trying to run it produces the following:

$ ./hello.ts
Check file:///tmp/deno-run/hello.ts
Hello world

$ ./hello
error: Uncaught SyntaxError: Unexpected token ':'
let s: string = "Hello world"
^
at <anonymous> (file:///tmp/deno-run/hello:3:6)

As there could be multiple reasons to have a CLI executable named without the .ts extension, I think it would be great to have something like deno run --ts or deno run --language=ts in order to force TypeScript processing of the specified script.
Issue 1:
Kind of related #2073

It seems to me there's a natural correlation between mount and update methods:

getInitialState => componentWillReceiveProps
(always true) => shouldComponentUpdate
componentWillMount => componentWillUpdate
componentDidMount => componentDidUpdate

In many situations you want to have the same code for mount/update, but you have to put it in a shared method and call it from both places. It's hardly common enough that it's an issue, but it seems common enough that it strikes me as a bit odd... perhaps. Just an idea, could it make sense to e.g. get rid of mount altogether and instead have the following (it's extreme perhaps, but just as an example):

// mounting
getInitialState
componentWillReceiveProps(update = false?)
componentWillUpdate(update = false)
componentDidUpdate(update = false)

// updating
componentWillReceiveProps(update = true?)
shouldComponentUpdate
componentWillUpdate(update = true)
componentDidUpdate(update = true)

It would unify the life-cycle and move away from mounting being treated as entirely separate from updating, it would then be seen as an exception. There would be less potential for inconsistencies causes by mistake/neglect.

I haven't thought this through extensively and bring it up mainly to start a discussion, I know many others have wondered why there isn't a life-cycle method for mount+update.

Issue 2:
Describe what you were doing when the bug occurred:

Record a 5 second profile in the React Profiler Tab

Switch the React root in the dropdown

Please do not remove the text below this line

DevTools version: 4.2.0-a8b8ffb89

Call stack: at n.value (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:162685)

at m (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:332158)

at sc (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:332375)

at fi (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:59263)

at Hi (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:66573)

at lc (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:104884)

at kc (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:89467)

at wc (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:89392)

at pc (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:86341)

at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:32:45721

Component stack: in sc

in div

in div

in _o

in Unknown

in n

in Unknown

in div

in div

in zi

in Ge

in un

in ba

in Rc
Issue 1:
I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

In component decorator, selector is unable to select id by hashtag (#)

Expected behavior

Component selector should be able to select id by hashtag (#)

Minimal reproduction of the problem with instructions

Simply change you component selector by using #id

@Component({
selector: '#top-navigation',
templateUrl: './top-navigation.component.html',
styleUrls: ['./top-navigation.component.scss']
})

What is the motivation / use case for changing the behavior?

Currently, I need to select it like,

@Component({
selector: '[id=top-navigation]',
templateUrl: './top-navigation.component.html',
styleUrls: ['./top-navigation.component.scss']
})

Please tell us about your environment:

Ubuntu 14.04, Sublime, Webpack, Apache

Angular version: 2.0.X

Angular 2.0.0

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

All browsers

Language: [all | TypeScript X.X | ES6/7 | ES5]

TypeScript 2.0.2

Issue 2:
I'm submitting a:

[x] bug report

Current behavior

select: '#my-component' doesn't work.

Expected behavior

Given <div id="my-component"></div> in a template, select: '#my-component' should work the same, as the following combinations work:

select: 'my-component' works for <my-component></my-component>

select: [my-component] works for <div my-component></div>

select: '.my-component' works for <div class="my-component"></div>

Reproduction of the problem

https://plnkr.co/edit/rbMDTr15R51CVvWHC1V5?p=preview

Angular version: 2.0.1

Browser: [ only tested in Chrome and Firefox ]

Language: [ TypeScript ]
Issue 1:
For example, our builds include the -httptest.serve flag from the net/http/httptest package (pulled in through github.com/stretchr/testify/assert).

Files which should probably be excluded from release binaries (but are currently included):

pkg/volume/mock_volume.go
pkg/volume/testing.go
pkg/kubelet/network/testing.go
pkg/kubelet/container/runtime_mock.go
pkg/kubelet/prober/testing.go
pkg/kubelet/cadvisor/cadvisor_mock.go
pkg/kubelet/server/stats/mock_stats_provider.go

Issue 2:
By default cAdvisor currently gathers stats every 1 second. This is much higher than necessary for most use cases, so we should override the default value to 10 seconds in the Kubelet.

The flag which needs to be modified is:

--housekeeping-interval=1s: Interval between container housekeepings

/cc @kubernetes/goog-node
Issue 1:
Mike Rokitka opened SPR-5359 and commented

HTML code generated via Spring's form tag library for checkboxes and radiobuttons is generating invalid HTML id attributes (square brackets to represent array). This appears to work fine for the other form input types, but the HTML is incorrect for checkboxes and radiobuttons.

Sample code:

<c:forEach var="currentTest" items="${testForm.tests}" varStatus="itStatus">

<li>

<form:checkbox path="tests[${itStatus.index}].copy"/>

</li>

</c:forEach>

Generates the following HTML for the checkbox:

<input id="tests[0].copy1" name="tests[0].copy" type="checkbox" value="true"/><input type="hidden" name="_tests[0].copy" value="on"/>

Changing the form:checkbox tag to a form:hidden tag renders valid HTML:

<input id="tests0.copy" name="tests[0].copy" type="hidden" value="false"/>

This appears to be related to this issue: http://jira.springframework.org/browse/SPR-2380?

Affects: 2.5.6

Issue 2:
Ilya opened SPR-5382 and commented

org.springframework.web.servlet.tags.form.TagIdGenerator which is used by tags checkboxes and radiobuttons doesn't filter out [] and double-quotes from id attribute. It breaks html and javascript for map-based properties. Can be fixed like this:

public static String nextId(String name, PageContext pageContext) {
String attributeName = PAGE_CONTEXT_ATTRIBUTE_PREFIX + name;
Integer currentCount = (Integer) pageContext.getAttribute(attributeName);
currentCount = (currentCount != null ? new Integer(currentCount.intValue() + 1) : new Integer(1));
pageContext.setAttribute(attributeName, currentCount);
return (StringUtils.deleteAny(name, "[]\"") + currentCount.intValue());
}

Issue Links:

#11537 Spring MVC regression: binding to indexed properties is broken

#11506 form:checkbox tag creates invalid HTML id when bound to indexed property

Backported to: 3.0.1
Issue 1:
Hi, I'm trying to build a model with functional API. But I got some error only when I use BatchNorm layer . A toy example:

import numpy as np
from keras.layers import Input, BatchNormalization, Dense
from keras.models import Model

# model1:
input1 = Input((10,))
bn1 = BatchNormalization()(input1)
out1 = Dense(2, activation='softmax')(bn1)
model1 = Model(input1, out1)

# model2:
input2 = Input((10,))
out2 = Dense(10, activation='relu')(input2)
model2 = Model(input2, out2)

# model3 is just a simple stack of model1 and model2:
input3 = Input((10,))
out3 = model1(model2(input3))
model3 = Model(input3, out3)

# compile and train:
model1.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
y = np.zeros((10, 2))
x = np.zeros((10, 10))
model1.train_on_batch(x, y)

Then I get InvalidArgumentError: You must feed a value for placeholder tensor 'input_3' with dtype float. But model1 has nothing to do with input3 if I train it separately. The weird thing is that if I remove bn1 of model1 or change it to layers like Dense, this error will disappear.

I use tensorflow backend and both tensorflow and keras are updated. Do I use functional API in the wrong way or it is a potential bug?

Issue 2:
The problem I am facing is that the input size is variable and I don't know how to get a symbolic shape in the middle of the graph.

Is there a way to:

Get the symbolic shape of a layer

Specify a symbolic (i.e. variable at run time) target_shape in Reshape(target_shape)

At the moment I came up with this ugly workaround. Is there something better?

x_shape = [10, None, None, None, 3] # batch + 4 axes
model = models.Sequential()
model.add(Convolution2D(64, 3, 3, border_mode='same', input_shape=x_shape[1:]))
# Will this cause the theano graph to be duplicated??
sh = model.get_output().shape
# Is there an easier way with core.Reshape??
model.add(Lambda(lambda x: x.flatten(ndim=2), output_shape=flattened_shape))
model.add(Activation(K.softmax))
reshape = Lambda(lambda x: x.reshape((sh[0], sh[1], T.prod(sh[2:]))))

# this is what I'd like to do instead
# model.add(Reshape((x.shape[0], x.shape[1], x.shape[2]*x.shape[3])))
Issue 1:
Consider:

class Apple {
private size: number;

constructor(size: number) {
this.size = size;
}

get Size(): number {
return this.size;
}
}

let a: Apple = new Apple(4);
console.log(a.Size);
a.Size = 5; // should this should throw a compile time error?

It strikes me that the attempted assignment to a.Size should produce a compile time error.

Instead we learn about it at runtime (target es6 with v1.6.0-dev.20150806)

[Error: Cannot set property Size of #<Apple> which has only a getter]

Thoughts?

Issue 2:
If a property has a getter but no setter (or vice versa) than perhaps the attempt to set or get should be flagged as an error:

class Fields{
get ReadOnly(){
return 10;
}

public written:number;
set WriteOnly(value:number){
this.written = value;
}
}

var obj = new Fields();

console.log(obj.ReadOnly); // 10
obj.ReadOnly = 20; // cannot set but no error
console.log(obj.ReadOnly) // 10

obj.WriteOnly = 20;
console.log(obj.written) // 20
console.log(obj.WriteOnly); // cannot read but no error

No biggie. But something to be aware of. (ported from http://typescript.codeplex.com/workitem/834)
Issue 1:
Feature request

Is your feature request related to a problem? Please describe.

Amazon API Gateways have a stage in their URLs:

E.g. https://vbe6aad5c.execute-api.us-east-1.amazonaws.com/prod/home

This breaks next8 serverless page deployments routing because there doesn't seem to be a way to configure nextjs with a basePath (/prod in this case).

Describe the solution you'd like

I would like to be able to configure nextjs with a uri basePath which works with next's routing.

Could be something like:

next.config.js

module.exports = {
uriBasePath: '/prod'
}

Note assetPrefix doesn't work here because it applies only to static files AFAIK.

Describe alternatives you've considered

Using a custom domain for the AWS API GW would solve the problem as it removes the /{stage} from the URL.

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Following the README.md instructions on cloning and running the app should result in a running app, compiled correctly.

Current Behavior

Running npm i && npm run dev:

Fails to build the app. Reason is, package.json specifies older react version but latest next.js

After upgrading react to 16, runtime error occurs due to missing "Transform Decorators Legacy" babel plugin.

After runningnpm install babel-plugin-transform-decorators-legacy the app loads without errors.

Steps to Reproduce (for bugs)

Clone the repo in a clean environment.

Run npm i && npm run dev

Update React dependencies, and repeat (2)

Open the browser to http://localhost:3000/

Context

Attempting to learn how to integrate ant design into next.js app.

Your Environment

Tech
Version

next
4.1.3

node
7.3.0

OS
MacOS Sierra 10.12.6

browser
Google Chrome

react
^16.0.0

react-dom
^16.0.0

Suggested fix:

In package.json, use the following dependencies:

"dependencies": {
"antd": "^2.10.2",
"babel-plugin-import": "^1.1.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0"
}

or, alternatively, fix next version. Note that with the above package.json, I see the following errors running npm list command:

npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0, required by react-lazy-load@3.0.12 npm ERR! peer dep missing: react@^0.14.0 || ^15.0.1, required by react-slick@0.15.4 npm ERR! peer dep missing: react-dom@^0.14.0 || ^15.0.0-0, required by react-lazy-load@3.0.12 npm ERR! peer dep missing: react-dom@^0.14.0 || ^15.0.1, required by react-slick@0.15.4 npm ERR! peer dep missing: jquery@>=1.8.0, required by slick-carousel@1.8.1