Skip to content

updated incorrect description of input object #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bhargavyagnik
Copy link

@bhargavyagnik bhargavyagnik commented Apr 12, 2021

Old
// responses is an array of the following structure:
// {
// response: string;
// context?: string;
// }

The error obtained in running the code :
universal-sentence-encoder:17 Uncaught (in promise) TypeError: e.normalize is not a function
at universal-sentence-encoder:17
at c.encode (universal-sentence-encoder:17)
at universal-sentence-encoder:17
at Array.map ()
at j.tokenizeStrings (universal-sentence-encoder:17)
at universal-sentence-encoder:17
at tfjs:17
at e.t.scopedRun (tfjs:17)
at e.t.tidy (tfjs:17)
at Object.bx [as tidy] (tfjs:17)

This error is due to the incorrect object definition of "input"
On observation of the code of universal-sentence-encoder, we see that

embed(e) {
            const n = t.tidy(()=>{
                const t = this.tokenizeStrings(e.queries, f)
                  , n = this.tokenizeStrings(e.responses, f);
                if (null != e.contexts && e.contexts.length !== e.responses.length)
                    throw new Error("The length of response strings and context strings need to match.");
                const o = e.contexts || [];

So e.queries and e.contexts show that the input object should be

input =
{
    queries: string[],
    responses: string[],
    contexts:string[]
}

So that is what I propose to be updated in the readme


This change is Reviewable

Old
  // responses is an array of following structure:
  // {
  //   response: string;
  //   context?: string;
  // }

The error obtained in running the code : 
universal-sentence-encoder:17 Uncaught (in promise) TypeError: e.normalize is not a function
    at universal-sentence-encoder:17
    at c.encode (universal-sentence-encoder:17)
    at universal-sentence-encoder:17
    at Array.map (<anonymous>)
    at j.tokenizeStrings (universal-sentence-encoder:17)
    at universal-sentence-encoder:17
    at tfjs:17
    at e.t.scopedRun (tfjs:17)
    at e.t.tidy (tfjs:17)
    at Object.bx [as tidy] (tfjs:17)

This error is  due to incorrect object definition of "input"
On observation of  the code of universal-sentence-encoder , we see that  
---
embed(e) {
            const n = t.tidy(()=>{
                const t = this.tokenizeStrings(e.queries, f)
                  , n = this.tokenizeStrings(e.responses, f);
                if (null != e.contexts && e.contexts.length !== e.responses.length)
                    throw new Error("The length of response strings and context strings need to match.");
                const o = e.contexts || [];
---
So e.queries and e.contexts show that the input object should be

input =  
{
    queries: string[],
    responses: string[],
    contexts:string[]
}

So that i what i propose be updated in the readme
updated incorrect description of input object in universal-sentence-encoder
@google-cla
Copy link

google-cla bot commented Apr 12, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Apr 12, 2021
@bhargavyagnik
Copy link
Author

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Apr 12, 2021
Copy link
Contributor

@jenperson jenperson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1.
Reviewable status: 0 of 1 approvals obtained (waiting on @bhargavyagnik)


universal-sentence-encoder/README.md line 102 at r1 (raw file):

  //    queries:string[];
  //    responses:string[];
  //    context:string[];   

This should be contexts


universal-sentence-encoder/README.md line 104 at r1 (raw file):

  //    context:string[];   
  // }
  // context is optional, it provides the context string of the answer.

contexts*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants