segment-dict
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,3 +0,3 @@ | ||
export declare type IDictID = 'jieba-js' | 'nodejieba' | 'segment' | 'stopword'; | ||
export declare type IDictID = 'jieba-js' | 'nodejieba' | 'segment' | 'stopword' | 'synonym'; | ||
export declare function getDictPath(id: IDictID, file: string, ...argv: string[]): string; | ||
export default getDictPath; |
@@ -8,3 +8,3 @@ /** | ||
export type IDictID = 'jieba-js' | 'nodejieba' | 'segment' | 'stopword'; | ||
export type IDictID = 'jieba-js' | 'nodejieba' | 'segment' | 'stopword' | 'synonym'; | ||
@@ -11,0 +11,0 @@ export function getDictPath(id: IDictID, file: string, ...argv: string[]) |
@@ -27,1 +27,3 @@ /// <reference types="node" /> | ||
}; | ||
import * as self from './line'; | ||
export default self; |
@@ -29,3 +29,3 @@ "use strict"; | ||
if (src.cwd && !path.isAbsolute(src.path)) { | ||
p = path.join(src.cwd, src.path); | ||
p = path.resolve(src.cwd, src.path); | ||
} | ||
@@ -108,1 +108,3 @@ self.bytesSize = fs.statSync(p).size; | ||
*/ | ||
const self = require("./line"); | ||
exports.default = self; |
@@ -57,3 +57,3 @@ /** | ||
{ | ||
p = path.join(src.cwd, src.path); | ||
p = path.resolve(src.cwd, src.path); | ||
} | ||
@@ -174,1 +174,4 @@ | ||
*/ | ||
import * as self from './line'; | ||
export default self; |
/// <reference types="bluebird" /> | ||
import * as Promise from 'bluebird'; | ||
import { IStreamLineWithValue } from '../fs/line'; | ||
import * as JIEBA from './jieba'; | ||
@@ -15,4 +16,7 @@ import * as SEGMENT from './segment'; | ||
load(file: string): Promise<T>; | ||
loadSync(file: string): T; | ||
loadStream(): IStreamLineWithValue<T>; | ||
loadStreamSync(): IStreamLineWithValue<T>; | ||
default(file: string): Promise<T>; | ||
}; | ||
export default requireDefault; |
import * as Promise from 'bluebird'; | ||
import * as path from "path"; | ||
import { ROOT } from '../../index'; | ||
import { IStreamLineWithValue } from '../fs/line'; | ||
import * as JIEBA from './jieba'; | ||
@@ -27,2 +28,7 @@ import * as SEGMENT from './segment'; | ||
load(file: string): Promise<T>, | ||
loadSync(file: string): T, | ||
loadStream(): IStreamLineWithValue<T>, | ||
loadStreamSync(): IStreamLineWithValue<T>, | ||
default(file: string): Promise<T>, | ||
@@ -29,0 +35,0 @@ } |
@@ -7,3 +7,3 @@ /// <reference types="bluebird" /> | ||
import * as Promise from 'bluebird'; | ||
import { ICallback } from '../../fs/stream'; | ||
import createLoadStream, { ICallback } from '../../fs/stream'; | ||
export declare type IDictRow = [string, number, string]; | ||
@@ -18,3 +18,6 @@ export declare type IDict = IDictRow[]; | ||
export declare function load(file: string): Promise<IDict>; | ||
export declare function loadSync(file: string): [string, number, string][]; | ||
export declare function _createStream<IDict>(fnStream: typeof createLoadStream, file: string, callback?: ICallback<IDict>): IStreamLineWithValue<IDict>; | ||
export declare function loadStream(file: string, callback?: ICallback<IDict>): IStreamLineWithValue<[string, number, string][]>; | ||
export declare function loadStreamSync(file: string, callback?: ICallback<IDict>): IStreamLineWithValue<[string, number, string][]>; | ||
export default load; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const stream_1 = require("../../fs/stream"); | ||
const sync_1 = require("../../fs/sync"); | ||
/** | ||
@@ -46,4 +47,8 @@ * 云计算 | ||
exports.load = load; | ||
function loadStream(file, callback) { | ||
let stream = stream_1.default(file, { | ||
function loadSync(file) { | ||
return loadStreamSync(file).value; | ||
} | ||
exports.loadSync = loadSync; | ||
function _createStream(fnStream, file, callback) { | ||
return fnStream(file, { | ||
callback, | ||
@@ -56,5 +61,12 @@ mapper(line) { | ||
}); | ||
return stream; | ||
} | ||
exports._createStream = _createStream; | ||
function loadStream(file, callback) { | ||
return _createStream(stream_1.default, file, callback); | ||
} | ||
exports.loadStream = loadStream; | ||
function loadStreamSync(file, callback) { | ||
return _createStream(sync_1.default, file, callback); | ||
} | ||
exports.loadStreamSync = loadStreamSync; | ||
exports.default = load; |
@@ -8,2 +8,3 @@ /** | ||
import createLoadStream, { ICallback } from '../../fs/stream'; | ||
import createLoadStreamSync from '../../fs/sync'; | ||
@@ -66,6 +67,11 @@ export type IDictRow = [string, number, string]; | ||
export function loadStream(file: string, callback?: ICallback<IDict>) | ||
export function loadSync(file: string) | ||
{ | ||
let stream = createLoadStream<IDict>(file, { | ||
return loadStreamSync(file).value; | ||
} | ||
export function _createStream<IDict>(fnStream: typeof createLoadStream, file: string, callback?: ICallback<IDict>) | ||
{ | ||
return fnStream<IDict>(file, { | ||
callback, | ||
@@ -82,6 +88,14 @@ | ||
}); | ||
} | ||
return stream; | ||
export function loadStream(file: string, callback?: ICallback<IDict>) | ||
{ | ||
return _createStream(createLoadStream, file, callback) | ||
} | ||
export function loadStreamSync(file: string, callback?: ICallback<IDict>) | ||
{ | ||
return _createStream(createLoadStreamSync, file, callback) | ||
} | ||
export default load; |
@@ -7,3 +7,3 @@ /// <reference types="bluebird" /> | ||
import * as Promise from 'bluebird'; | ||
import { ICallback } from '../../fs/stream'; | ||
import createLoadStream, { ICallback } from '../../fs/stream'; | ||
export declare type IDictRow = [string, number, number]; | ||
@@ -16,3 +16,6 @@ export declare type IDict = IDictRow[]; | ||
export declare function load(file: string): Promise<IDict>; | ||
export declare function loadSync(file: string): [string, number, number][]; | ||
export declare function _createStream<IDict>(fnStream: typeof createLoadStream, file: string, callback?: ICallback<IDict>): IStreamLineWithValue<IDict>; | ||
export declare function loadStream(file: string, callback?: ICallback<IDict>): IStreamLineWithValue<[string, number, number][]>; | ||
export declare function loadStreamSync(file: string, callback?: ICallback<IDict>): IStreamLineWithValue<[string, number, number][]>; | ||
export default load; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const stream_1 = require("../../fs/stream"); | ||
const sync_1 = require("../../fs/sync"); | ||
/** | ||
@@ -26,4 +27,8 @@ * 爱|0x1000|323 | ||
exports.load = load; | ||
function loadStream(file, callback) { | ||
let stream = stream_1.default(file, { | ||
function loadSync(file) { | ||
return loadStreamSync(file).value; | ||
} | ||
exports.loadSync = loadSync; | ||
function _createStream(fnStream, file, callback) { | ||
return fnStream(file, { | ||
callback, | ||
@@ -36,5 +41,12 @@ mapper(line) { | ||
}); | ||
return stream; | ||
} | ||
exports._createStream = _createStream; | ||
function loadStream(file, callback) { | ||
return _createStream(stream_1.default, file, callback); | ||
} | ||
exports.loadStream = loadStream; | ||
function loadStreamSync(file, callback) { | ||
return _createStream(sync_1.default, file, callback); | ||
} | ||
exports.loadStreamSync = loadStreamSync; | ||
exports.default = load; |
@@ -8,2 +8,3 @@ /** | ||
import createLoadStream, { ICallback } from '../../fs/stream'; | ||
import createLoadStreamSync from '../../fs/sync'; | ||
@@ -36,6 +37,11 @@ export type IDictRow = [string, number, number]; | ||
export function loadStream(file: string, callback?: ICallback<IDict>) | ||
export function loadSync(file: string) | ||
{ | ||
let stream = createLoadStream<IDict>(file, { | ||
return loadStreamSync(file).value; | ||
} | ||
export function _createStream<IDict>(fnStream: typeof createLoadStream, file: string, callback?: ICallback<IDict>) | ||
{ | ||
return fnStream<IDict>(file, { | ||
callback, | ||
@@ -52,6 +58,14 @@ | ||
}); | ||
} | ||
return stream; | ||
export function loadStream(file: string, callback?: ICallback<IDict>) | ||
{ | ||
return _createStream(createLoadStream, file, callback) | ||
} | ||
export function loadStreamSync(file: string, callback?: ICallback<IDict>) | ||
{ | ||
return _createStream(createLoadStreamSync, file, callback) | ||
} | ||
export default load; |
@@ -7,3 +7,3 @@ /// <reference types="bluebird" /> | ||
import * as Promise from 'bluebird'; | ||
import { ICallback } from '../../fs/stream'; | ||
import createLoadStream, { ICallback } from '../../fs/stream'; | ||
export declare type IDictRow = string[]; | ||
@@ -16,3 +16,6 @@ export declare type IDict = IDictRow[]; | ||
export declare function load(file: string): Promise<IDict>; | ||
export declare function loadSync(file: string): string[][]; | ||
export declare function _createStream<IDict>(fnStream: typeof createLoadStream, file: string, callback?: ICallback<IDict>): IStreamLineWithValue<IDict>; | ||
export declare function loadStream(file: string, callback?: ICallback<IDict>): IStreamLineWithValue<string[][]>; | ||
export declare function loadStreamSync(file: string, callback?: ICallback<IDict>): IStreamLineWithValue<string[][]>; | ||
export default load; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const stream_1 = require("../../fs/stream"); | ||
const sync_1 = require("../../fs/sync"); | ||
/** | ||
@@ -29,4 +30,8 @@ * 揭穿,戳穿 | ||
exports.load = load; | ||
function loadStream(file, callback) { | ||
let stream = stream_1.default(file, { | ||
function loadSync(file) { | ||
return loadStreamSync(file).value; | ||
} | ||
exports.loadSync = loadSync; | ||
function _createStream(fnStream, file, callback) { | ||
return fnStream(file, { | ||
callback, | ||
@@ -39,5 +44,12 @@ mapper(line) { | ||
}); | ||
return stream; | ||
} | ||
exports._createStream = _createStream; | ||
function loadStream(file, callback) { | ||
return _createStream(stream_1.default, file, callback); | ||
} | ||
exports.loadStream = loadStream; | ||
function loadStreamSync(file, callback) { | ||
return _createStream(sync_1.default, file, callback); | ||
} | ||
exports.loadStreamSync = loadStreamSync; | ||
exports.default = load; |
@@ -8,2 +8,3 @@ /** | ||
import createLoadStream, { ICallback } from '../../fs/stream'; | ||
import createLoadStreamSync from '../../fs/sync'; | ||
@@ -41,6 +42,11 @@ export type IDictRow = string[]; | ||
export function loadStream(file: string, callback?: ICallback<IDict>) | ||
export function loadSync(file: string) | ||
{ | ||
let stream = createLoadStream<IDict>(file, { | ||
return loadStreamSync(file).value; | ||
} | ||
export function _createStream<IDict>(fnStream: typeof createLoadStream, file: string, callback?: ICallback<IDict>) | ||
{ | ||
return fnStream<IDict>(file, { | ||
callback, | ||
@@ -57,6 +63,14 @@ | ||
}); | ||
} | ||
return stream; | ||
export function loadStream(file: string, callback?: ICallback<IDict>) | ||
{ | ||
return _createStream(createLoadStream, file, callback) | ||
} | ||
export function loadStreamSync(file: string, callback?: ICallback<IDict>) | ||
{ | ||
return _createStream(createLoadStreamSync, file, callback) | ||
} | ||
export default load; |
{ | ||
"name": "segment-dict", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "segment data", | ||
@@ -9,6 +9,11 @@ "keywords": [ | ||
"analyzer", | ||
"async", | ||
"chinese", | ||
"chinese segmentation", | ||
"data", | ||
"dict", | ||
"file", | ||
"jieba", | ||
"load", | ||
"loader", | ||
"machine learning", | ||
@@ -23,2 +28,4 @@ "morphological analysis", | ||
"split", | ||
"stream", | ||
"sync", | ||
"text mining", | ||
@@ -25,0 +32,0 @@ "tokenizer", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38183884
47
1175
0
3