forked from mindspore-Ecosystem/mindspore
!13459 Add example for ngram
From: @ezphlow Reviewed-by: @heleiwang,@liucunwei Signed-off-by: @liucunwei
This commit is contained in:
commit
d7e7df3a68
|
@ -299,7 +299,11 @@ class Ngram(TextTensorOperation):
|
|||
(default=None, which will use whitespace as separator).
|
||||
|
||||
Examples:
|
||||
>>> ngram_op = text.Ngram(3, separator="")
|
||||
>>> ngram_op = text.Ngram(3, separator="-")
|
||||
>>> output = ngram_op(["WildRose Country", "Canada's Ocean Playground", "Land of Living Skies"])
|
||||
>>> # output
|
||||
>>> # ["WildRose Country-Canada's Ocean Playground-Land of Living Skies"]
|
||||
>>> # same ngram_op called through map
|
||||
>>> text_file_dataset = text_file_dataset.map(operations=ngram_op)
|
||||
"""
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ class Slice(cde.SliceOp):
|
|||
2. :py:obj:`list(int)`: Slice these indices along the first dimension. Negative indices are supported.
|
||||
3. :py:obj:`slice`: Slice the generated indices from the slice object along the first dimension.
|
||||
Similar to start:stop:step.
|
||||
4. :py:obj:`None`: Slice the whole dimension. Similar to :py:obj:`:` in Python indexing.
|
||||
4. :py:obj:`None`: Slice the whole dimension. Similar to :py:obj:`[:]' in Python indexing.
|
||||
5. :py:obj:`Ellipsis`: Slice the whole dimension, same result with `None`.
|
||||
|
||||
Examples:
|
||||
|
|
|
@ -1118,6 +1118,8 @@ class RandomRotation(ImageTensorOperation):
|
|||
degrees = degrees % 360
|
||||
if isinstance(degrees, (list, tuple)):
|
||||
degrees = [degrees[0] % 360, degrees[1] % 360]
|
||||
if degrees[0] > degrees[1]:
|
||||
degrees[1] += 360
|
||||
|
||||
self.degrees = degrees
|
||||
self.resample = resample
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "include/api/status.h"
|
||||
#include "include/api/types.h"
|
||||
#include "minddata/dataset/core/tensor_shape.h"
|
||||
#include "minddata/dataset/core/type_id.h"
|
||||
#include "minddata/dataset/core/de_tensor.h"
|
||||
#include "minddata/dataset/core/type_id.h"
|
||||
#include "utils/log_adapter.h"
|
||||
|
||||
using mindspore::Status;
|
||||
|
|
Loading…
Reference in New Issue