Non documented jsonb_to_tsvector function [closed] - postgresql

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am using PstgreSQL v12, and there is a native function \df jsonb_to_tsvector... But it is not described at pg guide functions-json neither other page. It is a interesting function, can I use it, is reliable? Or it is a kind of "lost in namespace" bug?
Important: even if google found it, I see citation absence (or absence of "also see" section) as a PG Guide bug. It is a jsonb_* native function: all must be cited at pg guide functions-json.
NOTES
At this old page of 2018 we can found something as:
CREATE TABLE test (id int, payload jsonb);
INSERT INTO test VALUES
(1,'{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","Abbrev":"ISO 8879:1986","SortAs":"SGML","Acronym":"SGML","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup","GlossTerm":"Standard Generalized Markup Language"}}}}}'::jsonb)
,(2,'{"menu":{"id":"file","popup":{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"}]},"value":"File"}}'::jsonb)
,(3,'{"x":[1,2,3]}'::jsonb)
;
-- it is running and results are fine!
SELECT id, jsonb_to_tsvector('english', payload, '["all"]') FROM test;
SELECT id, jsonb_to_tsvector('english', payload, '["numeric","key"]') FROM test;
... and that it is "2 years lost".
(edited after answered)
Voting the IDEAL GUIDE
At answer comments #a_horse_with_no_name explain my position, "... with your logic, array_to_tsvector would need to be listed with the array functions...",
and that his position is the opposit.
The Stackoverflow community is democratic, we can use an efficient voting mechanism. I am creating a Wiki answer to you vote below as an alternative answer... Let's do an experiment. Each answer is an postion alternative:
vote this answer below for "no See also section" and no citations. You agree that Guide is good as it is, and a hub page not need to cite other functions.
vote this other answer below for "See also section" or completeness of citations. You agree that the Guide is not good, and a hub page need to cite other functions.
Time to vote at postgresql.org/docs?
I never understood why "our" PostgreSQL guide at postgresql.org/docs does not offer "See also" sections.
Almost all Wikipedia articles have a "See also" section, and almost all popular programming languages:
PHP example, PostGIS example, etc. or "see also" box like Python guide.
In a good programming language it is not difficult to classify and define groups of native functions, on the basis of shared characteristics.
PostgreSQL have a big community, so it is easy also to check consensus about defining groups of similar native functions... And sometimes is more easy: all functions with the prefix array_ are in the set of "all native array functions", all functions with the prefix jsonb_ are in the set of "all native JSONb functions".
It is also a kind of "completeness princicle for Guides": a Guide's page that explain "all functions of group G" need to explain, or at least to cite, all functions of the G group. The page "JSON functions" is for all native JSON functions, the page "ARRAY functions" is for all native JSON functions.
PS: about "native function" definition in this context, extensions are excluded from it. For example jsonb functions and array functions of extensions, like hstore are not native.
Problem: is there, at postgresql.org/docs, a democratic mechanism to vote, like here?

The function is documented in the text search functions
reduce each value in the document, specified by filter to a tsvector, and then concatenate those in document order to produce a single tsvector.

This answer is a Wiki (your vote goes to nobody) and is not a real answer, it is a kind of voting experient... I is a "place to vote" an alternative position. The two alternatives are:
here
and the
a_horse_with_no_name answer.
Position here: the Guide needs a "see also" section or similar thing
"See also section" or function name citations, for completeness in a "all native functions of group" page. Example: the page Guide of all native ARRAY functions, the page of all all native JSON functions, etc.
Vote here if you agree that the Guide is not good, and a hub page need to cite other functions.

Related

Existing Tools for Simple Math Expression Equivalence Logic [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
This question has some good responses, but has been moved to a more appropriate forum at this link.
Online systems, such as ALEKS, Cengage's WebAssign, and even Khan Academy employ some kind of logical matching for polynomial expressions and numerical values (ie, fractions). What unpaid tools (libraries, command line programs, scripts, etc) exist that can provide expression/numerical matching? For example, a student enters the expression
but the following expression is equivalent and would also be acceptable:
The question about how to do this mathematically has an excellent answer in this post, and a question addressing one particular way to implement this has a partial answer in this post. Sympy looks promising, but the command line Maxima could work, and so could the WolframAlpha API, Maple, MatLab, and any number of symbolic computer algebra systems.
It's fine to talk about things that "could work", but what tools are already being used? How has this already been implemented? Can anyone speak from experience about what online math learning programs are using on the backend? Give examples or direct to existing projects.
To clarify the question, I'm talking about logically comparing simple expressions(middle/high school math), minimally complicated, with canonical forms typically easy to obtain. The implementation will be online (html+nifty_tool) and input will most likely be captured as a string unless someone can suggest a better input method for math learners - a LaTeX front-end perhaps?
Providing that you could translate the student's input into Python it would be easy enough to verify the equality of expressions in most cases. For instance,
>>> from sympy import *
>>> var('p')
p
>>> f_1 = 2*p**2*(p+5)-8
>>> f_2 = 2*(p**2+4*p-4)*(p+1)
>>> f_1.expand()==f_2.expand()
True
If you have an input widget that enables a student to enter expressions of the kind displayed in your question, and that outputs LaTeX, say, then you might be able to use a parser such as https://github.com/alvinwan/tex2py to get the inputs you need for sympy.
Take a look at STACK, which is an automated system for assessing students' math answers. STACK is based on Maxima. The main web site appears to be: http://www.stack.ed.ac.uk/
I found some other links that could be interesting to you:
Moodle plugin for STACK: https://moodle.org/plugins/qtype_stack
Resources for the Moodle plugin at Github: https://github.com/maths/moodle-qtype_stack
Some description about how STACK uses Maxima: https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Maxima.md
I'm actually not sure how STACK makes use of Maxima to determine whether an answer is correct. If the form of the answer doesn't matter, then ratsimp(answer - expected) should be 0 if answer is equivalent to expected. But if the form of the answer must be verified as well, the comparison becomes more complicated. I can imagine some ways to do that, but I don't know what STACK actually does.
I see the issues forum for the Github project (https://github.com/maths/moodle-qtype_stack/issues) seems to have a fair amount of traffic, so perhaps if you run into problems you can ask for help there.

Does Program-o uses NLP ?

I am trying to make chat bot. I searched for some solutions and programs to help me.
Can someone tell me if Program-o uses natural language processing?
I have searched on google but i didn't find the answer.
Program-O is basically the engine that uses recursive pattern-matching on AIML to find a suitable response.
The answer given here explains in a bit more detail NLP in AIML
The pertinent paragraph being:
If by "natural language processing" you mean what is commonly called a "learning bot," the ALICE (AIML) bot does not meet the definition. The ALICE program (whose "brain" is the AIML scripting language) is a pattern-matching program. It searches a fairly large database - usually about 40,000 entries - for a phrase or term that matches one in the input, then selects a reply from the set designated by the closest match. It neither writes to its own files or generates spontaneous output. It doesn't "learn" by itself. Any changes or new information must be hard-coded into the AIML files by the botmaster.

Canonical list of scala 'operators'

It seems easy to find general info on a specific 'operator' (method, syntactic sugar), but I can't seem to find anything that has a list of all, or even just most, of these goodies. As such, it makes it fairly difficult, or at least overly time consuming, to work through learning the language.
I have already looked over this question. While it has great information, and definitely shows you how to find any information you need, I was hoping for something like a 'pocket ref' that just had all the relevant info and was only dedicated to that.
So, my question is this:
Is there a such a list?
Am I getting ahead of myself by looking for such a reference early on in learning the language?
Thanks in advance.
Well, a list of all operators makes as much sense as a list of all methods in the library, regardless of the type. It isn't going to be particularly useful except for finding information about a specific operator.
However, if you do want one, at any ScalaDoc site (http://www.scala-lang.org/api/current/ for the standard library) there is an alphabetic index just under the search bar. The first link (#) lists all the non-alphabetic methods (i.e. "operators").
Many of these are rarely used, or only in specific circumstances.
Obviously, any other library can introduce its own operators, and you'll need to check its own documentation.

Which new features are (or will be) added to Scaladoc in Scala 2.10? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Among all the various incomplete lists of features going into Scala 2.10, there are various mentions of improvements to Scaladoc. But it's unclear which ones there are, and which ones are actually going in -- e.g. one of the lists of improvements says "fixes to Scaladoc" with links to various pull requests, some of which got rejected.
Can anyone summarize what's actually changed between Scala 2.9 and 2.10 milestone 4, and maybe indicate what else is planned for 2.10 itself?
Also, are they finally going to fix the problem of not being able to link to methods? E.g. littered throughout my code I have things like this:
/**
* Reverse the encoding computed using `encode_ngram`.
*/
def decode_ngram(ngram: String): Iterable[String] = {
DistDocument.decode_ngram_for_counts_field(ngram)
}
where I want to refer to another method in the same class, but AFAIK there's simply no way to do it. IMO it should be something obvious like [[encode_ngram]] -- i.e. I definitely shouldn't need to give an absolute class (which would make everything break as soon as I pull out a class and stick it somewhere else), and I shouldn't need to give the parameter types if the method name itself is unambiguous (i.e. non-polymorphic).
Several new features, as well as many bugfixes are coming, but there's no definitive list of all the fixes that are in, yet. Of the more notable new features:
Implicitly added members will now be visible. A good example is to look at scala.Array, where methods like map which you might've assumed you had are now visible in the Scaladoc.
Automatically-generated SVG inheritance diagrams, for a bird's eye view of relationships between classes/traits/objects at the package-level and then also at the level of individual classes etc. For example, see the Scaladoc diagrams nightly at both the package-level (click "Content Hierarchy") as well as at the class-level.
Method-linking in some limited form should go into 2.10 (not in the nightly yet). (It's actually not totally trivial to implement in its complete form, due to practical stuff like overloading, as you noted.)
Improved use cases A member with a use case isn't doubly generated anymore, and they're now a bit clearer and simpler than before.
(Less-notable) Keyboard shortcuts for navigating Scaladoc have been added, they're explained here and here
For a more exhaustive list of bugfixes, it might be a good idea to write to scala-internals-- there's a good chance someone will compile a list of all major bugfixes in the past year for you there.

How was the Google Books' Popular passages feature developed?

I'm curious if anyone understands, knows or can point me to comprehensive literature or source code on how Google created their popular passage blocks feature. However, if you know of any other application that can do the same please post your answer too.
If you do not know what I am writing about here is a link to an example of Popular Passages. When you look at the overview of the book Modelling the legal decision process for information technology applications ... By Georgios N. Yannopoulos you can see something like:
Popular passages
... direction, indeterminate. We have
not settled, because we have not
anticipated, the question which will
be raised by the unenvisaged case when
it occurs; whether some degree of
peace in the park is to be sacrificed
to, or defended against, those
children whose pleasure or interest it
is to use these things. When the
unenvisaged case does arise, we
confront the issues at stake and can
then settle the question by choosing
between the competing interests in the
way which best satisfies us. In
doing...‎ Page 86
Appears in 15 books from 1968-2003
This would be a world fit for
"mechanical" jurisprudence. Plainly
this world is not our world; human
legislators can have no such knowledge
of all the possible combinations of
circumstances which the future may
bring. This inability to anticipate
brings with it a relative
indeterminacy of aim. When we are bold
enough to frame some general rule of
conduct (eg, a rule that no vehicle
may be taken into the park), the
language used in this context fixes
necessary conditions which anything
must satisfy...‎ Page 86
Appears in 8 books from 1968-2000
more
It must be an intensive pattern matching process. I can only think of n-gram models, text corpus, automatic plagisrism detection. But, sometimes n-grams are probabilistic models for predicting the next item in a sequence and text corpus (to my knowledge) are manually created. And, in this particular case, popular passages, there can be a great deal of words.
I am really lost. If I wanted to create such a feature, how or where should I start? Also, include in your response what programming languages are best suited for this stuff: F# or any other functional lang, PERL, Python, Java... (I am becoming a F# fan myself)
PS: can someone include the tag automatic-plagiarism-detection, because i can't
Read this ACM paper by Kolak and Schilit, the Google researchers who developed Popular Passages. There are also a few relevant slides from this MapReduce course taught by Baldridge and Lease at The University of Texas at Austin.
In the small sample I looked over, it looks like all the passages picked were inline or block quotes. Just a guess, but perhaps Google Books looks for quote marks/differences in formatting and a citation, then uses a parsed version of the bibliography to associate the quote with the source. Hooray for style manuals.
This approach is obviously of no help to detect plagiarism, and is of little help if the corpus isn't in a format that preserves text formatting.
If you know which books are citing or referencing other books you don't need to look at all possible books only the books that are citing each other. If is is scientific reference often line and page numbers are included with the quote or can be found in the bibliography at the end of the book, so maybe google parses only this informations?
Google scholar certainly has the information about citing from paper to paper maybe from book to book too.