Skip to content

Commit

Permalink
Improve Dataset#slice argument handling
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jan 6, 2018
1 parent 4e9291f commit 67350a2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/wapiti/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ def sample(n = 1, **options)
Dataset.new sequences.sample(n, **options)
end

def slice(*args)
Dataset.new [*sequences.slice(*args)]
def slice(start, length = 1)
if Range === start
Dataset.new sequences.slice(start)
else
Dataset.new sequences.slice(start, length)
end
end

def +(other)
Expand Down

0 comments on commit 67350a2

Please sign in to comment.