1

I'm looking for some service that provides short definitions for IT-related terms e.g C++, Java, MySQL, MongoDB, Linux etc.

Stack overflow tags system has similar functionality and it would be sufficient for me but there is additional information about tag itself in addition to term definition.

For example, I'm sending this request.

https://api.stackexchange.com/2.2/tags/maven/wikis?site=stackoverflow

I'm getting

...
         "excerpt":
"Apache Maven is a build automation and project management tool 
used primarily for Java projects. 
This tag is for questions that don't relate to a specific Maven version. 
Use the gradle tag instead for questions relating to Gradle.",
         "tag_name":"maven"
...

I need exactly the first sentence.

Does anybody know something similar to this?

Or maybe there is a more appropriate way of using SO tags API rather than requesting tag wikis.

1 Answer 1

0

Assuming you want to use the stackexchange web-API, and you always want the first sentence and only the first sentence, you could write a little script to do this.

Here is how I'd do this in R:

library(tidytext)   # contains unnest_tokens()
library(tidyverse)  # contains %>% and select()
library(jsonlite)   # get JSON data from web, return as R list

myurl <- "https://api.stackexchange.com/2.2/tags/maven/wikis?site=stackoverflow"

(fromJSON(myurl))$items %>%
  tbl_df() %>%                   # convert to data frame
  select(excerpt) %>%            # keep only "excerpt" column
  # split into sentences
  unnest_tokens( token ="sentences", 
                 input = excerpt, output = txt, 
                 to_lower = FALSE) %>%
  select(txt) %>%   # choose the txt column 
  # take the first sentence
  head(1) %>%
  pull()  # get as string + print whole thing even if it is long

Result:

[1] "Apache Maven is a build automation and project management tool used primarily for Java projects."

You have to download some third-party code / R packages I've used in the calls to library(). This is a one-off task but can take quite a while initially bceause a lot of dependencies have to be installed!

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.