-
Notifications
You must be signed in to change notification settings - Fork 16
/
span.h
56 lines (45 loc) · 1012 Bytes
/
span.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// span.h
//
// URL: https://github.com/d99kris/spacy-cpp
//
// Copyright (C) 2017-2020 Kristofer Berggren
// All rights reserved.
//
// spacy-cpp is distributed under the MIT license, see LICENSE for details.
#pragma once
#include <string>
#include <vector>
#include "pyobjectptr.h"
namespace Spacy
{
class Doc;
class Python;
class Token;
class Span
{
friend Doc;
friend Python;
public:
virtual ~Span();
const Doc* doc() const;
long label() const;
std::string label_() const;
std::string lemma_() const;
std::string orth_() const;
Token root() const;
double sentiment() const;
std::string text() const;
std::string text_with_ws() const;
std::vector<Token> tokens() const;
double vector_norm() const;
private:
Span(PyObjectPtr p_span, const Doc* p_parent = nullptr);
void set_parent(Doc* p_parent);
private:
PyObjectPtr m_span;
const Doc* m_parent;
};
}
#ifdef SPACY_HEADER_ONLY
#include "span.cpp"
#endif