Document extractor service (#15665)
* Document extractor service * Fixing vendor modules * Addressing PR Review comments * Some small simplifications * Fixing a linter complain * simplifying a bit the code using package variables Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
04ef5c682e
Коммит
8d5be2d657
67
vendor/github.com/gigawattio/window/.gitignore
сгенерированный
поставляемый
Обычный файл
67
vendor/github.com/gigawattio/window/.gitignore
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,67 @@
|
||||
##
|
||||
# Vim swap/working files.
|
||||
*.sw[opa]
|
||||
|
||||
##
|
||||
# SublimeText files.
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
##
|
||||
# IDEA IntelliJ files.
|
||||
*.idea
|
||||
*.iml
|
||||
|
||||
##
|
||||
# Visual Studio Code files.
|
||||
.vscode
|
||||
|
||||
##
|
||||
# Mac OS-X miscellany.
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
._*
|
||||
|
||||
##
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
##
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects).
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
##
|
||||
# Folders.
|
||||
_obj
|
||||
_test
|
||||
|
||||
##
|
||||
# Architecture specific extensions/prefixes.
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
##
|
||||
# Certificate files.
|
||||
id_[rd]sa
|
||||
*.pem
|
||||
*.crt
|
||||
*.key
|
||||
16
vendor/github.com/gigawattio/window/.travis.yml
сгенерированный
поставляемый
Обычный файл
16
vendor/github.com/gigawattio/window/.travis.yml
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,16 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- tip
|
||||
- "1.10"
|
||||
- 1.9
|
||||
- 1.8
|
||||
- 1.7
|
||||
|
||||
script:
|
||||
- go test ./...
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: change
|
||||
on_failure: always
|
||||
21
vendor/github.com/gigawattio/window/LICENSE
сгенерированный
поставляемый
Обычный файл
21
vendor/github.com/gigawattio/window/LICENSE
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 GigawattIO
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
23
vendor/github.com/gigawattio/window/README.md
сгенерированный
поставляемый
Обычный файл
23
vendor/github.com/gigawattio/window/README.md
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,23 @@
|
||||
# window
|
||||
|
||||
[](https://godoc.org/github.com/gigawattio/window)
|
||||
[](https://travis-ci.org/gigawattio/window)
|
||||
[](https://goreportcard.com/report/github.com/gigawattio/window)
|
||||
|
||||
### About
|
||||
|
||||
Window is a golang package for generating a rolling window of size N for a sequence of string tokens.
|
||||
|
||||
Created by [Jay Taylor](https://jaytaylor.com/) and used by [Gigawatt](https://gigawatt.io/).
|
||||
|
||||
### Requirements
|
||||
|
||||
* Go version 1.7 or newer
|
||||
|
||||
### Running the test suite
|
||||
|
||||
go test ./...
|
||||
|
||||
#### License
|
||||
|
||||
Permissive MIT license, see the [LICENSE](LICENSE) file for more information.
|
||||
24
vendor/github.com/gigawattio/window/rolling.go
сгенерированный
поставляемый
Обычный файл
24
vendor/github.com/gigawattio/window/rolling.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,24 @@
|
||||
package window
|
||||
|
||||
// Rolling generates a rolling window of size N for a sequence of string tokens.
|
||||
func Rolling(elements []string, n int) [][]string {
|
||||
if len(elements) == 0 || len(elements) < n || n <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
accum = make([][]string, len(elements)+1-n)
|
||||
j int
|
||||
)
|
||||
|
||||
for i := 0; i < len(elements)+1-n; i++ {
|
||||
win := make([]string, n)
|
||||
win[0] = elements[i]
|
||||
for j = 0; j+1 < n; j++ {
|
||||
win[j+1] = elements[i+j+1]
|
||||
}
|
||||
accum[i] = win
|
||||
}
|
||||
|
||||
return accum
|
||||
}
|
||||
Ссылка в новой задаче
Block a user