hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
109
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
48.5k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63a28920e4ba0045de7941f79cfc5ffca9df04e8
| 25,199
|
cpp
|
C++
|
oldsrc/mjpgserver.cpp
|
frc5431/Perception
|
d6284459b6df2a9455282629df330a43a054e10d
|
[
"MIT"
] | null | null | null |
oldsrc/mjpgserver.cpp
|
frc5431/Perception
|
d6284459b6df2a9455282629df330a43a054e10d
|
[
"MIT"
] | null | null | null |
oldsrc/mjpgserver.cpp
|
frc5431/Perception
|
d6284459b6df2a9455282629df330a43a054e10d
|
[
"MIT"
] | null | null | null |
/**
CS-11 Format
File: mjpgserver.cpp
Purpose: Capture/process mats and display on http stream
@author David Smerkous
@version 1.0 8/11/2016
License: MIT License (MIT)
Copyright (c) 2016 David Smerkous
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.
*/
#include "../include/mjpgserver.hpp"
MjpgServer::MjpgServer(int port) {
this->port = port;
}
MjpgServer::~MjpgServer()
{
std::cout << "Dismounting " << this->name << " server!";
this->unint(); //Call the users soft unmount code
}
void MjpgServer::attach(cv::Mat (*pullframe)(void))
{
this->pullframe = pullframe; //Look at mainloop
}
void MjpgServer::setCapAttach(int value) //Set physical device pull with safety
{
this->cap.open(value);
boost::this_thread::sleep_for(boost::chrono::milliseconds(250)); //Keeps from overreading
this->capattach_in(); //Call default attach method
}
void MjpgServer::setCapAttach(std::string value) //Set stream to pull from
{
this->cap.open(value);
boost::this_thread::sleep_for(boost::chrono::milliseconds(250));
this->capattach_in();
}
void MjpgServer::setQuality(int quality)
{
this->quality = quality;
}
int MjpgServer::getQuality()
{
return (this->quality);
}
void MjpgServer::setFPS(int fps)
{
this->controlfps = fps;
}
int MjpgServer::getFPS()
{
boost::mutex::scoped_lock l(this->global_mutex);
return (this->fps);
}
void MjpgServer::setResolution(int width, int height)
{
this->resized[0] = width;
this->resized[1] = height;
}
int* MjpgServer::getResolution()
{
return (this->resized);
}
void MjpgServer::setSettle(int fps)
{
this->settlefps = fps;
std::cout << "New settle fps: " << this->settlefps << std::endl;
}
void MjpgServer::setMaxConnections(int connections)
{
this->maxconnections = connections;
}
int MjpgServer::getMaxConnections()
{
return (this->maxconnections);
}
int MjpgServer::getConnections()
{
return (this->connections);
}
void MjpgServer::capattach_in()
{
int tries = 0;
while(!cap.isOpened()) {
if(tries++ > this->maxfailpackets) break;
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
} //Make sure we are connected before continuing
this->setSettle((int) cap.get(cv::CAP_PROP_FPS));
const auto proc = [this]() -> cv::Mat
{
cv::Mat frame;
try {
if(!this->cap.read(frame)) return (frame);
}
catch (std::exception& err)
{
std::cerr << "Overread on stream" << std::endl;
}
return frame;
};
const auto deproc = [this]() -> void
{
try {
this->cap.release();
}
catch(cv::Exception& err)
{
std::cerr << "Release capture error: " << err.what() << std::endl;
}
};
static auto static_proc = proc;
static auto static_deproc = deproc;
cv::Mat (*ptr) () = []() -> cv::Mat { return static_proc(); }; //Create the captured lambdas into function pointers
void (*dptr) () = []() -> void { return static_deproc(); };
this->attach(ptr);
this->detacher(dptr);
}
void MjpgServer::detacher(void (*detacher)(void))
{
this->unint = detacher;
}
void MjpgServer::setName(std::string new_name)
{
this->name = new_name;
}
std::string MjpgServer::convertString()
{
std::vector<uchar> buff;
if(this->resized[0] > 0)
{
cv::resize(this->curframe, this->curframe, cv::Size(this->resized[0], this->resized[1]), 0, 0, cv::INTER_LINEAR); // If resize then do so
}
if(this->quality > -1) //If specified quality then do so
{
std::vector<int> compression_params;
compression_params.push_back(cv::IMWRITE_JPEG_QUALITY);
compression_params.push_back(this->quality);
cv::imencode(".jpg", this->curframe, buff, compression_params);
}
else
{
cv::imencode(".jpg", this->curframe, buff);
}
std::string content(buff.begin(), buff.end());
return (content);
}
void MjpgServer::handleJpg(asio::ip::tcp::socket &socket)
{
boost::mutex mutex;
std::cout << "Client requested single image!" << std::endl;
boost::mutex::scoped_lock l(mutex);
this->connections += 1;
try
{
this->curframe = this->pullframe();
std::string content = this->convertString();
std::stringstream response;
response << "HTTP/1.1 200 OK\r\nContent-Type: image/jpeg\r\nServer: " << this->host_name;
response << "\r\nContent-Length: " << content.length() << "\r\n\r\n" << content;
if(!sendresponse(socket, response.str())) throw std::invalid_argument("send error");
}
catch(std::exception& err)
{
std::cerr << "Error sending image to client!" << std::endl;
std::string resp = "<p>Failed sending image</p>";
sendError(socket, resp);
}
this->connections -= 1;
}
void MjpgServer::mainPullLoop()
{
boost::mutex mutex;
mutex.lock();
this->pullcap = true;
mutex.unlock();
try {
for(int test = 0; test < 3; test++)
{
mutex.lock();
try
{
this->pullframe();
}
catch(std::exception& err) {}
mutex.unlock();
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
}
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point now = start;
while(1)
{
now = std::chrono::high_resolution_clock::now();
float delta = std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count();
start = now;
float timepoint = 1000 / (float) (this->settlefps > 0) ?
this->settlefps : (this->controlfps > 0) ?
this->controlfps : 1000;
int sleepoint = 2;
if(delta < timepoint)
{
sleepoint = (((int) (timepoint - delta)) * 2) - 3;
}
boost::this_thread::sleep_for(boost::chrono::milliseconds(sleepoint));
mutex.lock();
try
{
this->curframe = this->pullframe();
if(!this->curframe.empty())
this->content = this->convertString();
}
catch(std::exception& pullerror) {
std::cerr << "Image pull error: " << pullerror.what() << std::endl;
}
mutex.unlock();
}
} catch(const std::exception &err) {
std::cerr << "Got error: " << err.what() << std::endl;
}
mutex.lock();
this->pullcap = false;
mutex.unlock();
}
void MjpgServer::handleMjpg(asio::ip::tcp::socket &socket)
{
//Tell client mjpg stream is going to be sent
std::stringstream respcompile;
respcompile << "HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace; boundary=";
respcompile << this->boundary << "\r\nServer: " << this->host_name;
respcompile << "\r\n\r\n";
std::string initresponse = respcompile.str();
boost::mutex mutex;
this->connections += 1;
if(!sendresponse(socket, initresponse))
{
std::cerr << "Failed to initiate stream with client... removing client" << std::endl;
return;
}
else
std::cout << "Client connected to stream!" << std::endl;
long failcount = 0;
static int frames = 0;
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
if(!this->pullcap)
{
boost::thread(boost::bind(&MjpgServer::mainPullLoop, this));
}
std::chrono::high_resolution_clock::time_point point = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point now = point;
while(1) // Loop forever
{
try
{
int sleepint = 2; //Default sleep when target not specified
{
//scoped lock without delay
boost::mutex::scoped_lock l(mutex);
if(this->content.length() < 3) //this->curframe.empty()) {
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(2));
continue;
}
std::stringstream response;
response << this->boundary << "\r\nContent-Type: image/jpeg\r\nContent-Length: " << this->content.length() << "\r\n\r\n" << this->content;
if(!sendresponse(socket, response.str()))
{
if(failcount++ > this->maxfailpackets) break;
}
now = std::chrono::high_resolution_clock::now();
float delta = std::chrono::duration_cast<std::chrono::milliseconds>(now - point).count();
point = now;
float timepoint = 1000.0f / (float) this->controlfps;
if(delta < timepoint && this->controlfps > 0)
{
sleepint = (((int) (timepoint - delta)) * 2);
}
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count();
frames++;
if(duration > 250 && frames > this->samplefps)
{
this->fps = (float) ((frames * 1000) / duration);
start = now;
frames = 0;
}
}
boost::this_thread::sleep_for(boost::chrono::milliseconds(sleepint));
}
catch(cv::Exception& err)
{
std::cout << "CV ERROR: " << err.what() << std::endl;
}
catch(std::exception& err)
{
std::cout << "Client disconnect" << std::endl;
break;
}
}
this->connections -= 1;
}
void MjpgServer::handleHtml(asio::ip::tcp::socket &socket, std::string& root) //Look at onAccept
{
boost::mutex mutex;
boost::mutex::scoped_lock l(mutex);
std::stringstream p_con;
p_con << "<html><head></head><body><img src=\"" << root << "\"/></body></html>";
std::string main_content = p_con.str();
std::stringstream content;
content << "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Length: " << main_content.length();
content << "\r\nServer: " << this->host_name;
content << "\r\n\r\n" << main_content;
sendresponse(socket, content.str());
}
void MjpgServer::sendSimple(asio::ip::tcp::socket &socket, std::string& simple) //Look at onAccept
{
std::stringstream content;
content << "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: " << simple.length();
content << "\r\nServer: " << this->host_name;
content << "\r\n\r\n" << simple;
sendresponse(socket, content.str());
}
void MjpgServer::onAccept(asio::ip::tcp::socket &socket) //Look at onAccept
{
boost::mutex mutex;
while(1)
{
std::string httprequest;
std::vector<std::string> reqs;
std::map<std::string, std::string> headers;
try
{
httprequest = this->readrequest(socket);
if(httprequest == this->badread) throw std::invalid_argument("bad read");
headers = this->parseheaders(httprequest);
reqs = typeReq(httprequest);
}
catch(std::exception& err)
{
std::cerr << "String parse error" << std::endl;
break;
}
try
{
if(reqs[2] != "HTTP/1.1") throw std::invalid_argument("HTTP");
}
catch(std::exception& err)
{
std::cerr << "Bad HTTP request" << std::endl;
std::string resp = "<p>Request needs to be <b>HTTP/1.1</b></p>";
sendError(socket, resp);
break;
}
std::string req_type;
std::string path;
std::string extension;
try
{
req_type = reqs[0];
std::stringstream pathgen;
pathgen << "http://" << headers["Host"];
pathgen << reqs[1];
path = pathgen.str();
extension = reqs[1];
}
catch(std::exception& err)
{
std::cerr << "String parse error" << std::endl;
std::string resp = "<p>Request faced internal server error <b>(Couldn't part headers)</b></p>";
sendError(socket, resp);
continue;
}
try
{
if(extension == "/mjpg")
{
if(this->maxconnections > 0 && this->connections >= this->maxconnections)
{
this->sendError(socket, this->tooManyErr);
break;
}
try
{
this->handleMjpg(socket);
}
catch(std::exception& mjpgerr)
{
std::cerr << "Error handling mjpg stream with client: " << mjpgerr.what() << std::endl;
}
break;
}
else if(extension == "/" || extension == "/html")
{
if(this->maxconnections > 0 && this->connections >= this->maxconnections)
{
this->sendError(socket, this->tooManyErr);
break;
}
try
{
std::stringstream mjpgpath;
mjpgpath << "http://" << headers["Host"] << "/mjpg";
std::string newpath(mjpgpath.str());
this->handleHtml(socket, newpath);
}
catch(std::exception& errsend)
{
std::cerr << "Error html request: " << errsend.what() << std::endl;
break;
}
}
else if(extension == "/jpg") //Send single image
{
try
{
this->handleJpg(socket);
}
catch(std::exception& imageerr)
{
std::cerr << "Error jpg send: " << imageerr.what() << std::endl;
}
break;
}
else if(extension == "/fps") //REST control fps
{
std::string tosend;
boost::mutex::scoped_lock l(mutex);
try
{
if(req_type == "GET")
{
std::cout << "Requested to get fps" << std::endl;
std::stringstream ss;
ss << (int) this->fps; //Turn the float to int to string
tosend = ss.str();
this->sendSimple(socket, tosend);
}
else if(req_type == "POST")
{
std::string body = this->getBody(httprequest);
this->controlfps = atoi(body.c_str());
tosend = ""; //Send empty response since it's a simple response
this->sendSimple(socket, tosend);
std::cout << "Requested to set fps to: " << this->controlfps << " Completed" << std::endl;
}
else
{
this->sendError(socket, this->defErr);
}
break;
}
catch(std::exception& err)
{
std::cerr << "Bad request on resolution" << std::endl;
this->sendError(socket, this->defErr);
}
}
else if(extension == "/quality")
{
std::string tosend;
boost::mutex::scoped_lock l(mutex);
try
{
if(req_type == "GET")
{
std::cout << "Requested to get quality" << std::endl;
std::stringstream ss;
ss << (int) this->quality;
tosend = ss.str();
this->sendSimple(socket, tosend);
}
else if(req_type == "POST")
{
std::string body = this->getBody(httprequest);
this->quality = atoi(body.c_str());
tosend = "";
this->sendSimple(socket, tosend);
std::cout << "Requested to set quality to: " << this->quality << " Completed" << std::endl;
}
else
{
this->sendError(socket, this->defErr);
}
break;
}
catch(std::exception& err)
{
std::cerr << "Bad request on quality" << std::endl;
this->sendError(socket, this->defErr);
}
}
else if(extension == "/connections")
{
std::string tosend;
boost::mutex::scoped_lock l(mutex);
try
{
if(req_type == "GET")
{
std::cout << "Requested to get connections" << std::endl;
std::stringstream ss;
ss << this->connections;
tosend = ss.str();
this->sendSimple(socket, tosend);
}
else if(req_type == "POST")
{
std::string body = this->getBody(httprequest);
this->maxconnections = atoi(body.c_str());
tosend = "";
this->sendSimple(socket, tosend);
std::cout << "Requested to set max connections to: " << this->maxconnections << " Completed" << std::endl;
}
else
{
this->sendError(socket, this->defErr);
}
break;
}
catch(std::exception& err)
{
std::cerr << "Bad request on connections" << std::endl;
}
}
else if(extension == "/resolution")
{
std::string tosend;
boost::mutex::scoped_lock l(mutex);
try
{
if(req_type == "GET")
{
std::cout << "Requested to get resolution" << std::endl;
std::stringstream ss;
int width = this->curframe.cols;
int height = this->curframe.rows;
ss << width << "x" << height;
tosend = ss.str();
this->sendSimple(socket, tosend);
}
else if(req_type == "POST")
{
std::string body = this->getBody(httprequest);
std::string dim = body.substr(0, body.find("x"));
this->resized[0] = atoi(dim.c_str());
dim = body.substr(body.find("x") + 1);
this->resized[1] = atoi(dim.c_str());
tosend = "";
this->sendSimple(socket, tosend);
std::cout << "Requested to set resolution to: " << body << " Completed" << std::endl;
}
else
{
this->sendError(socket, this->defErr);
}
break;
}
catch(std::exception& err)
{
std::cerr << "Bad request on resolution" << std::endl;
this->sendError(socket, this->defErr);
}
}
else
{
std::string resp = "<p>404 Page not found! please use <b>.../mjpg, .../html, .../jpg or controls (fps, quality, resolution)</b></p>";
sendError(socket, resp);
break;
}
}
catch(std::exception& err)
{
std::cerr << "Loop error" << std::endl;
continue;
}
}
try
{
socket.close();
}
catch(std::exception& safetyclose) {}
}
std::map<std::string, std::string> MjpgServer::parseheaders(const std::string response)
{
std::map<std::string, std::string> mapper;
std::istringstream resp(response);
std::string header;
std::string::size_type index;
while (std::getline(resp, header) && header != "\r")
{
index = header.find(':', 0);
if(index != std::string::npos)
{
mapper.insert(std::make_pair(
boost::algorithm::trim_copy(header.substr(0, index)),
boost::algorithm::trim_copy(header.substr(index + 1))
));
}
}
return mapper;
}
std::string MjpgServer::getBody(std::string &request)
{
return request.substr(request.find("\r\n\r\n") + 4, request.rfind("\r\n"));
}
std::vector<std::string> MjpgServer::typeReq(std::string request)
{
std::vector<std::string> ret;
try
{
std::string temp;
std::stringstream strings(request);
while(strings >> temp) ret.push_back(temp);
return ret;
}
catch(std::exception& err)
{
std::vector<std::string> ret2;
ret2.push_back(this->badread);
return ret2;
}
}
std::string MjpgServer::readrequest(asio::ip::tcp::socket &socket)
{
try
{
asio::streambuf buf;
asio::read_until( socket, buf, "\r\n" );
std::string data = asio::buffer_cast<const char*>(buf.data());
return data;
}
catch(std::exception& err)
{
std::cerr << "Request cancelled" << std::endl;
return this->badread;
}
}
bool MjpgServer::sendresponse(asio::ip::tcp::socket &socket, const std::string& str)
{
try
{
const std::string msg = str + "\r\n";
asio::write( socket, asio::buffer(msg));
return true;
}
catch(std::exception& err)
{
std::cerr << "Client write fail, pipe broken" << std::endl;
return false;
}
}
void MjpgServer::sendError(asio::ip::tcp::socket & socket, std::string &message)
{
std::string content = "<html><body><h1>" + this->name + " error:</h1>";
std::stringstream bad;
bad << "HTTP/1.1 500\r\nContent-Type: text/html\r\nContent-Length: " << (content.length() + message.length()) << "\r\n\r\n" << content << message << "</body></html>\r\n";
sendresponse(socket, content);
}
void MjpgServer::run(bool threaded_start) {
if(threaded_start) {
//boost::thread t(boost::bind(&MjpgServer::run, this));
boost::thread(boost::bind(&MjpgServer::mainPullLoop, this));
} else {
this->run();
}
}
void MjpgServer::run()
{
std::cout << "Welcome to: " << this->name << std::endl << "Waiting for a clients..." << std::endl;
asio::io_service io_service;
MjpgServer::server s(io_service, this, this->port);
io_service.run();
}
void MjpgServer::session::start(MjpgServer *server)
{
try
{
this->master = server;
boost::thread t(boost::bind(&MjpgServer::onAccept, server, boost::ref(this->socket_)));
}
catch(...)
{
std::cout << "Caught threading problem not quiting though..." << std::endl;
delete this;
}
}
tcp::socket& MjpgServer::session::socket()
{
return this->socket_;
}
void MjpgServer::server::start_accept()
{
session* new_session = new session(io_service_);
acceptor_.async_accept(new_session->socket(),
boost::bind(&server::handle_accept, this, new_session,
boost::asio::placeholders::error));
}
void MjpgServer::server::cleanup()
{
this->io_service_.stop();
}
void MjpgServer::server::handle_accept(session* new_session, const boost::system::error_code& error)
{
if (!error)
{
new_session->start(this->master);
}
else
{
delete new_session;
}
start_accept();
}
| 32.556848
| 174
| 0.513949
|
frc5431
|
63a50c9cf08b1770961cef79c5f9fc672cd1a602
| 692
|
hpp
|
C++
|
source/foundation/include/network_utils.hpp
|
maxcong001/cpp_rest_config
|
d30b3bab8b0c2b1285b7eca53e3b93fc2ae5ff6d
|
[
"MIT"
] | null | null | null |
source/foundation/include/network_utils.hpp
|
maxcong001/cpp_rest_config
|
d30b3bab8b0c2b1285b7eca53e3b93fc2ae5ff6d
|
[
"MIT"
] | null | null | null |
source/foundation/include/network_utils.hpp
|
maxcong001/cpp_rest_config
|
d30b3bab8b0c2b1285b7eca53e3b93fc2ae5ff6d
|
[
"MIT"
] | null | null | null |
#pragma once
#include <string>
#include "std_micro_service.hpp"
using namespace boost::asio;
using namespace boost::asio::ip;
namespace cfx {
using HostInetInfo = tcp::resolver::iterator;
class NetworkUtils {
private:
static HostInetInfo queryHostInetInfo();
static std::string hostIP(unsigned short family);
public:
// gets the host IP4 string formatted
static std::string hostIP4() {
return hostIP(AF_INET);
}
// gets the host IP6 string formatted
static std::string hostIP6() {
return hostIP(AF_INET6);
}
static std::string hostName() {
return ip::host_name();
}
};
}
| 19.222222
| 55
| 0.624277
|
maxcong001
|
63a6f9c4c4575242e95a808611e4738d63cf8df8
| 4,369
|
hpp
|
C++
|
3rdparty/kdl/src/chainiksolvervel_pinv.hpp
|
rocos-sia/rocos-app
|
83aa8aa31dd303d77693cfc5ad48055d051fa4bc
|
[
"MIT"
] | 3
|
2021-12-06T15:30:58.000Z
|
2022-03-29T13:21:40.000Z
|
3rdparty/kdl/src/chainiksolvervel_pinv.hpp
|
thinkexist1989/rocos-app
|
7d6ab256c8212504b0a8bbe1ec1dea0c41ea3ff2
|
[
"MIT"
] | null | null | null |
3rdparty/kdl/src/chainiksolvervel_pinv.hpp
|
thinkexist1989/rocos-app
|
7d6ab256c8212504b0a8bbe1ec1dea0c41ea3ff2
|
[
"MIT"
] | null | null | null |
// Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef KDL_CHAIN_IKSOLVERVEL_PINV_HPP
#define KDL_CHAIN_IKSOLVERVEL_PINV_HPP
#include "chainiksolver.hpp"
#include "chainjnttojacsolver.hpp"
#include "utilities/svd_HH.hpp"
namespace KDL
{
/**
* Implementation of a inverse velocity kinematics algorithm based
* on the generalize pseudo inverse to calculate the velocity
* transformation from Cartesian to joint space of a general
* KDL::Chain. It uses a svd-calculation based on householders
* rotations.
*
* @ingroup KinematicFamily
*/
class ChainIkSolverVel_pinv : public ChainIkSolverVel
{
public:
/// solution converged but (pseudo)inverse is singular
static const int E_CONVERGE_PINV_SINGULAR = +100;
/**
* Constructor of the solver
*
* @param chain the chain to calculate the inverse velocity
* kinematics for
* @param eps if a singular value is below this value, its
* inverse is set to zero, default: 0.00001
* @param maxiter maximum iterations for the svd calculation,
* default: 150
*
*/
explicit ChainIkSolverVel_pinv(const Chain& chain,double eps=0.00001,int maxiter=150);
~ChainIkSolverVel_pinv();
/**
* Find an output joint velocity \a qdot_out, given a starting joint pose
* \a q_init and a desired cartesian velocity \a v_in
*
* @return
* E_NOERROR=solution converged to <eps in maxiter
* E_SVD_FAILED=SVD computation failed
* E_CONVERGE_PINV_SINGULAR=solution converged but (pseudo)inverse is singular
*
* @note if E_CONVERGE_PINV_SINGULAR returned then converged and can
* continue motion, but have degraded solution
*
* @note If E_SVD_FAILED returned, then getSvdResult() returns the error code
* from the SVD algorithm.
*/
virtual int CartToJnt(const JntArray& q_in, const Twist& v_in, JntArray& qdot_out);
/**
* not (yet) implemented.
*
*/
virtual int CartToJnt(const JntArray& /*q_init*/, const FrameVel& /*v_in*/, JntArrayVel& /*q_out*/){return (error = E_NOT_IMPLEMENTED);};
/**
* Retrieve the number of singular values of the jacobian that are < eps;
* if the number of near zero singular values is > jac.col()-jac.row(),
* then the jacobian pseudoinverse is singular
*/
unsigned int getNrZeroSigmas()const {return nrZeroSigmas;};
/**
* Retrieve the latest return code from the SVD algorithm
* @return 0 if CartToJnt() not yet called, otherwise latest SVD result code.
*/
int getSVDResult()const {return svdResult;};
/// @copydoc KDL::SolverI::strError()
virtual const char* strError(const int error) const;
/// @copydoc KDL::SolverI::updateInternalDataStructures
virtual void updateInternalDataStructures();
private:
const Chain& chain;
ChainJntToJacSolver jnt2jac;
unsigned int nj;
Jacobian jac;
SVD_HH svd;
std::vector<JntArray> U;
JntArray S;
std::vector<JntArray> V;
JntArray tmp;
double eps;
int maxiter;
unsigned int nrZeroSigmas;
int svdResult;
};
}
#endif
| 36.714286
| 145
| 0.65713
|
rocos-sia
|
63b14fec965b5aaade086f26f0e77d66c8029494
| 43
|
cpp
|
C++
|
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/CompileFeatures/cxx_alignof.cpp
|
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
|
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
|
[
"MIT"
] | 107
|
2021-08-28T20:08:42.000Z
|
2022-03-22T08:02:16.000Z
|
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/CompileFeatures/cxx_alignof.cpp
|
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
|
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
|
[
"MIT"
] | 3
|
2021-09-08T02:18:00.000Z
|
2022-03-12T00:39:44.000Z
|
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/CompileFeatures/cxx_alignof.cpp
|
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
|
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
|
[
"MIT"
] | 16
|
2021-08-30T06:57:36.000Z
|
2022-03-22T08:05:52.000Z
|
int someFunc()
{
return alignof(int);
}
| 7.166667
| 22
| 0.627907
|
duonglvtnaist
|
63b26a6a25939b81b22037480038dfeb120d4dca
| 958
|
cpp
|
C++
|
codes/codechef/CHFNSWAP.cpp
|
smmehrab/problem-solving
|
4aeab1673f18d3270ee5fc9b64ed6805eacf4af5
|
[
"MIT"
] | null | null | null |
codes/codechef/CHFNSWAP.cpp
|
smmehrab/problem-solving
|
4aeab1673f18d3270ee5fc9b64ed6805eacf4af5
|
[
"MIT"
] | null | null | null |
codes/codechef/CHFNSWAP.cpp
|
smmehrab/problem-solving
|
4aeab1673f18d3270ee5fc9b64ed6805eacf4af5
|
[
"MIT"
] | null | null | null |
/*
************************************************
username : smmehrab
fullname : s.m.mehrabul islam
email : mehrab.24csedu.001@gmail.com
institute : university of dhaka, bangladesh
session : 2017-2018
************************************************
*/
#include<bits/stdc++.h>
using namespace std;
long long int solve(long long int sum) {
long double c = sum;
return (long long int) (-1.0 + sqrt(1+(4*c)))/2.00;
}
long long int nC2(long long int n) {
return (n*(n-1)) / 2;
}
int main() {
int testCases;
long long int n, pivot, sum, result;
cin >> testCases;
while (testCases--) {
cin >> n;
result = 0;
sum = (n*(n+1))/2;
if (sum%2==0) {
pivot = solve(sum);
result += n-pivot;
if (2 * ((pivot*pivot) + pivot) == ((n*n) + n)) result += nC2(pivot) + nC2(n-pivot);
}
cout << result << endl;
}
return 0;
}
| 23.365854
| 96
| 0.466597
|
smmehrab
|
63b488721f17a78b41de38e15bd8eea91c1bfb97
| 8,188
|
cpp
|
C++
|
obs-studio/plugins/win-capture/graphics-hook/d3d11-capture.cpp
|
noelemahcz/libobspp
|
029472b973e5a1985f883242f249848385df83a3
|
[
"MIT"
] | null | null | null |
obs-studio/plugins/win-capture/graphics-hook/d3d11-capture.cpp
|
noelemahcz/libobspp
|
029472b973e5a1985f883242f249848385df83a3
|
[
"MIT"
] | null | null | null |
obs-studio/plugins/win-capture/graphics-hook/d3d11-capture.cpp
|
noelemahcz/libobspp
|
029472b973e5a1985f883242f249848385df83a3
|
[
"MIT"
] | null | null | null |
#include <d3d11.h>
#include <dxgi.h>
#include "dxgi-helpers.hpp"
#include "graphics-hook.h"
struct d3d11_data {
ID3D11Device *device; /* do not release */
ID3D11DeviceContext *context; /* do not release */
uint32_t cx;
uint32_t cy;
DXGI_FORMAT format;
bool using_shtex;
bool multisampled;
ID3D11Texture2D *scale_tex;
ID3D11ShaderResourceView *scale_resource;
ID3D11VertexShader *vertex_shader;
ID3D11InputLayout *vertex_layout;
ID3D11PixelShader *pixel_shader;
ID3D11SamplerState *sampler_state;
ID3D11BlendState *blend_state;
ID3D11DepthStencilState *zstencil_state;
ID3D11RasterizerState *raster_state;
ID3D11Buffer *vertex_buffer;
union {
/* shared texture */
struct {
struct shtex_data *shtex_info;
ID3D11Texture2D *texture;
HANDLE handle;
};
/* shared memory */
struct {
ID3D11Texture2D *copy_surfaces[NUM_BUFFERS];
bool texture_ready[NUM_BUFFERS];
bool texture_mapped[NUM_BUFFERS];
uint32_t pitch;
struct shmem_data *shmem_info;
int cur_tex;
int copy_wait;
};
};
};
static struct d3d11_data data = {};
void d3d11_free(void)
{
if (data.scale_tex)
data.scale_tex->Release();
if (data.scale_resource)
data.scale_resource->Release();
if (data.vertex_shader)
data.vertex_shader->Release();
if (data.vertex_layout)
data.vertex_layout->Release();
if (data.pixel_shader)
data.pixel_shader->Release();
if (data.sampler_state)
data.sampler_state->Release();
if (data.blend_state)
data.blend_state->Release();
if (data.zstencil_state)
data.zstencil_state->Release();
if (data.raster_state)
data.raster_state->Release();
if (data.vertex_buffer)
data.vertex_buffer->Release();
capture_free();
if (data.using_shtex) {
if (data.texture)
data.texture->Release();
} else {
for (size_t i = 0; i < NUM_BUFFERS; i++) {
if (data.copy_surfaces[i]) {
if (data.texture_mapped[i])
data.context->Unmap(
data.copy_surfaces[i], 0);
data.copy_surfaces[i]->Release();
}
}
}
memset(&data, 0, sizeof(data));
hlog("----------------- d3d11 capture freed ----------------");
}
static bool create_d3d11_stage_surface(ID3D11Texture2D **tex)
{
HRESULT hr;
D3D11_TEXTURE2D_DESC desc = {};
desc.Width = data.cx;
desc.Height = data.cy;
desc.Format = data.format;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_STAGING;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
hr = data.device->CreateTexture2D(&desc, nullptr, tex);
if (FAILED(hr)) {
hlog_hr("create_d3d11_stage_surface: failed to create texture",
hr);
return false;
}
return true;
}
static bool create_d3d11_tex(uint32_t cx, uint32_t cy, ID3D11Texture2D **tex,
HANDLE *handle)
{
HRESULT hr;
D3D11_TEXTURE2D_DESC desc = {};
desc.Width = cx;
desc.Height = cy;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = apply_dxgi_format_typeless(
data.format, global_hook_info->allow_srgb_alias);
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
hr = data.device->CreateTexture2D(&desc, nullptr, tex);
if (FAILED(hr)) {
hlog_hr("create_d3d11_tex: failed to create texture", hr);
return false;
}
if (!!handle) {
IDXGIResource *dxgi_res;
hr = (*tex)->QueryInterface(__uuidof(IDXGIResource),
(void **)&dxgi_res);
if (FAILED(hr)) {
hlog_hr("create_d3d11_tex: failed to query "
"IDXGIResource interface from texture",
hr);
return false;
}
hr = dxgi_res->GetSharedHandle(handle);
dxgi_res->Release();
if (FAILED(hr)) {
hlog_hr("create_d3d11_tex: failed to get shared handle",
hr);
return false;
}
}
return true;
}
static inline bool d3d11_init_format(IDXGISwapChain *swap, HWND &window)
{
DXGI_SWAP_CHAIN_DESC desc;
HRESULT hr;
hr = swap->GetDesc(&desc);
if (FAILED(hr)) {
hlog_hr("d3d11_init_format: swap->GetDesc failed", hr);
return false;
}
data.format = strip_dxgi_format_srgb(desc.BufferDesc.Format);
data.multisampled = desc.SampleDesc.Count > 1;
window = desc.OutputWindow;
data.cx = desc.BufferDesc.Width;
data.cy = desc.BufferDesc.Height;
return true;
}
static bool d3d11_shmem_init_buffers(size_t idx)
{
bool success;
success = create_d3d11_stage_surface(&data.copy_surfaces[idx]);
if (!success) {
hlog("d3d11_shmem_init_buffers: failed to create copy surface");
return false;
}
if (idx == 0) {
D3D11_MAPPED_SUBRESOURCE map = {};
HRESULT hr;
hr = data.context->Map(data.copy_surfaces[idx], 0,
D3D11_MAP_READ, 0, &map);
if (FAILED(hr)) {
hlog_hr("d3d11_shmem_init_buffers: failed to get "
"pitch",
hr);
return false;
}
data.pitch = map.RowPitch;
data.context->Unmap(data.copy_surfaces[idx], 0);
}
return true;
}
static bool d3d11_shmem_init(HWND window)
{
data.using_shtex = false;
for (size_t i = 0; i < NUM_BUFFERS; i++) {
if (!d3d11_shmem_init_buffers(i)) {
return false;
}
}
if (!capture_init_shmem(&data.shmem_info, window, data.cx, data.cy,
data.pitch, data.format, false)) {
return false;
}
hlog("d3d11 memory capture successful");
return true;
}
static bool d3d11_shtex_init(HWND window)
{
bool success;
data.using_shtex = true;
success =
create_d3d11_tex(data.cx, data.cy, &data.texture, &data.handle);
if (!success) {
hlog("d3d11_shtex_init: failed to create texture");
return false;
}
if (!capture_init_shtex(&data.shtex_info, window, data.cx, data.cy,
data.format, false, (uintptr_t)data.handle)) {
return false;
}
hlog("d3d11 shared texture capture successful");
return true;
}
static void d3d11_init(IDXGISwapChain *swap)
{
HWND window;
HRESULT hr;
hr = swap->GetDevice(__uuidof(ID3D11Device), (void **)&data.device);
if (FAILED(hr)) {
hlog_hr("d3d11_init: failed to get device from swap", hr);
return;
}
data.device->Release();
data.device->GetImmediateContext(&data.context);
data.context->Release();
if (!d3d11_init_format(swap, window)) {
return;
}
const bool success = global_hook_info->force_shmem
? d3d11_shmem_init(window)
: d3d11_shtex_init(window);
if (!success)
d3d11_free();
}
static inline void d3d11_copy_texture(ID3D11Resource *dst, ID3D11Resource *src)
{
if (data.multisampled) {
data.context->ResolveSubresource(dst, 0, src, 0, data.format);
} else {
data.context->CopyResource(dst, src);
}
}
static inline void d3d11_shtex_capture(ID3D11Resource *backbuffer)
{
d3d11_copy_texture(data.texture, backbuffer);
}
static void d3d11_shmem_capture_copy(int i)
{
D3D11_MAPPED_SUBRESOURCE map;
HRESULT hr;
if (data.texture_ready[i]) {
data.texture_ready[i] = false;
hr = data.context->Map(data.copy_surfaces[i], 0, D3D11_MAP_READ,
0, &map);
if (SUCCEEDED(hr)) {
data.texture_mapped[i] = true;
shmem_copy_data(i, map.pData);
}
}
}
static inline void d3d11_shmem_capture(ID3D11Resource *backbuffer)
{
int next_tex;
next_tex = (data.cur_tex + 1) % NUM_BUFFERS;
d3d11_shmem_capture_copy(next_tex);
if (data.copy_wait < NUM_BUFFERS - 1) {
data.copy_wait++;
} else {
if (shmem_texture_data_lock(data.cur_tex)) {
data.context->Unmap(data.copy_surfaces[data.cur_tex],
0);
data.texture_mapped[data.cur_tex] = false;
shmem_texture_data_unlock(data.cur_tex);
}
d3d11_copy_texture(data.copy_surfaces[data.cur_tex],
backbuffer);
data.texture_ready[data.cur_tex] = true;
}
data.cur_tex = next_tex;
}
void d3d11_capture(void *swap_ptr, void *backbuffer_ptr)
{
IDXGIResource *dxgi_backbuffer = (IDXGIResource *)backbuffer_ptr;
IDXGISwapChain *swap = (IDXGISwapChain *)swap_ptr;
HRESULT hr;
if (capture_should_stop()) {
d3d11_free();
}
if (capture_should_init()) {
d3d11_init(swap);
}
if (capture_ready()) {
ID3D11Resource *backbuffer;
hr = dxgi_backbuffer->QueryInterface(__uuidof(ID3D11Resource),
(void **)&backbuffer);
if (FAILED(hr)) {
hlog_hr("d3d11_shtex_capture: failed to get "
"backbuffer",
hr);
return;
}
if (data.using_shtex)
d3d11_shtex_capture(backbuffer);
else
d3d11_shmem_capture(backbuffer);
backbuffer->Release();
}
}
| 22.070081
| 79
| 0.703102
|
noelemahcz
|
63bcab72a452811c8f9d5ea66266c5f66aece519
| 893
|
hpp
|
C++
|
libs/core/include/fcppt/math/dim/to_vector.hpp
|
freundlich/fcppt
|
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
|
[
"BSL-1.0"
] | 13
|
2015-02-21T18:35:14.000Z
|
2019-12-29T14:08:29.000Z
|
libs/core/include/fcppt/math/dim/to_vector.hpp
|
cpreh/fcppt
|
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
|
[
"BSL-1.0"
] | 5
|
2016-08-27T07:35:47.000Z
|
2019-04-21T10:55:34.000Z
|
libs/core/include/fcppt/math/dim/to_vector.hpp
|
freundlich/fcppt
|
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
|
[
"BSL-1.0"
] | 8
|
2015-01-10T09:22:37.000Z
|
2019-12-01T08:31:12.000Z
|
// Copyright Carl Philipp Reh 2009 - 2021.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef FCPPT_MATH_DIM_TO_VECTOR_HPP_INCLUDED
#define FCPPT_MATH_DIM_TO_VECTOR_HPP_INCLUDED
#include <fcppt/math/size_type.hpp>
#include <fcppt/math/detail/to_different.hpp>
#include <fcppt/math/dim/object_impl.hpp>
#include <fcppt/math/vector/object_impl.hpp>
#include <fcppt/math/vector/static.hpp>
namespace fcppt::math::dim
{
/**
\brief Converts a dim into a corresponding vector
\ingroup fcpptmathdim
*/
template <typename T, fcppt::math::size_type N, typename S>
inline fcppt::math::vector::static_<T, N> to_vector(fcppt::math::dim::object<T, N, S> const &_src)
{
return fcppt::math::detail::to_different<fcppt::math::vector::static_<T, N>>(_src);
}
}
#endif
| 28.806452
| 98
| 0.740202
|
freundlich
|
63c8f8b1ea31dfda8682020b417bfea4b5e42aca
| 2,638
|
cpp
|
C++
|
C++/Algorithms/Maths/maxPairwiseProduct.cpp
|
Rr1901/AlgorithmsAndDataStructure
|
b5606bbdc2a8e924a111e3757d02b3aeb780e053
|
[
"MIT"
] | 195
|
2020-05-09T02:26:13.000Z
|
2022-03-30T06:12:07.000Z
|
C++/Algorithms/Maths/maxPairwiseProduct.cpp
|
Trombokendu-dev/AlgorithmsAndDataStructure
|
acdef5145e53f71281e8ae353f90bda98b100063
|
[
"MIT"
] | 31
|
2021-06-15T19:00:57.000Z
|
2022-02-02T15:51:25.000Z
|
C++/Algorithms/Maths/maxPairwiseProduct.cpp
|
Trombokendu-dev/AlgorithmsAndDataStructure
|
acdef5145e53f71281e8ae353f90bda98b100063
|
[
"MIT"
] | 64
|
2020-05-09T02:26:15.000Z
|
2022-02-23T16:02:01.000Z
|
/*
Find the maximum product of two distinct numbers in a sequence of non-negative integers
Input: A sequence of non-negative integers
Output: The maximum value that can be obtained by multiplying two different elements from the sequence.
Input format. The first line contains an integer n. The next line contains n non-negative integers a1, . . . , an (separated by spaces).
Output format. The maximum pairwise product
Constraints. 2 ≤ n ≤ 2·10^5 ; 0 ≤ a1, . . . , an ≤ 2·10^5.
Time limit: 1 sec
Memory Limit: 512 Mb
Sample Input 1:
3
1 2 3
Sample Output 1:
6
Sample Input 2:
10
7 5 14 2 8 8 10 1 2 3
Sample Output 2:
140
*/
#include <iostream>
#include <vector>
#include <algorithm>
using std::vector;
using std::cin;
using std::cout;
using std::max;
// Naive algorithm to find the Maximum Pairwise Product. Takes O(n^2)
int64_t MaxPairwiseProductNaive(const std::vector<int64_t>& numbers) {
int64_t max_product = 0;
int n = numbers.size();
for (int first = 0; first < n; ++first) {
for (int second = first + 1; second < n; ++second) {
max_product = std::max(max_product,
(int64_t)( numbers[first] * numbers[second]));
}
}
return max_product;
}
// Faster solution to the Maximum Pairwise Product Problem. Takes O(nlogn)
int64_t MaxPairwiseProduct(std::vector<int64_t>& numbers) {
int n = numbers.size();
sort(numbers.begin(), numbers.end());
return numbers[n - 1] * numbers[n - 2];
}
// Function to stress test the problem
void stressTest(int64_t N, int64_t M) {
while(true) {
int64_t n = rand() % (N - 1) + 2;
std::cout << "\n" << n << "\n";
vector<int64_t> A(n);
for (int64_t i = 0; i < n; i++) {
A[i] = rand() % (M + 1);
}
for (int64_t i = 0; i < n; i++) {
cout << A[i] << " ";
}
int64_t result1 = MaxPairwiseProductNaive(A);
int64_t result2 = MaxPairwiseProduct(A);
if (result1 == result2) {
cout << "\nOK" << "\n";
} else {
cout << "\nWrong Answer: " << result1 << " " << result2 << "\n";
return;
}
}
}
int main() {
// To test the code, uncomment the following line and comment rest of the code in the main function.
// Feel free to play around with the values in the parameter
// stressTest(1000, 200000);
int n;
std::cin >> n;
std::vector<int64_t> numbers(n);
for (int i = 0; i < n; ++i) {
std::cin >> numbers[i];
}
std::cout << MaxPairwiseProduct(numbers) << "\n";
return 0;
}
| 29.640449
| 140
| 0.583776
|
Rr1901
|
63cf3bf684848e9ef41e5a46ec1c43a8ee729d1f
| 1,067
|
cpp
|
C++
|
examples/google-code-jam/bcurcio/probb.cpp
|
rbenic-fer/progauthfp
|
d0fd96c31ab0aab1a9acdcb7c75f2b430f51c675
|
[
"MIT"
] | null | null | null |
examples/google-code-jam/bcurcio/probb.cpp
|
rbenic-fer/progauthfp
|
d0fd96c31ab0aab1a9acdcb7c75f2b430f51c675
|
[
"MIT"
] | null | null | null |
examples/google-code-jam/bcurcio/probb.cpp
|
rbenic-fer/progauthfp
|
d0fd96c31ab0aab1a9acdcb7c75f2b430f51c675
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
int in(){int r=0,c;for(c=getchar_unlocked();c<=32;c=getchar_unlocked());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar_unlocked());return r;}
static const int dr[4] = {0, -1, 0, 1};
static const int dc[4] = {-1, 0, 1, 0};
//static const char dp[4] = {'W','S','E','N'};
#define LIM 1200
#define lim2 600
piii dp[LIM][LIM];
string solve(){
int X = in();
int Y = in();
int i;
string ans = "";
if(X>0){
for(i=0;i<X;i++){
ans+='W';
ans+='E';
}
}else{
for(i=0;i<-X;i++){
ans+='E';
ans+='W';
}
}
if(Y>0){
for(i=0;i<Y;i++){
ans+='S';
ans+='N';
}
}else{
for(i=0;i<-Y;i++){
ans+='N';
ans+='S';
}
}
return ans;
}
int main(){
for(int i=0,T=in();i<T;i++){
string ans = solve();
printf("Case #%d: %s\n",i+1,ans.c_str());
}
}
| 17.209677
| 160
| 0.501406
|
rbenic-fer
|
63d153a81a58c9e01d489f5923532357ee31c912
| 971
|
cpp
|
C++
|
week3/session2/class_template.cpp
|
horbosis556/CPP20-IntroductoryAssignments
|
efc8a3b88def3ce4847bcdf0d6f1f8009748caee
|
[
"MIT"
] | null | null | null |
week3/session2/class_template.cpp
|
horbosis556/CPP20-IntroductoryAssignments
|
efc8a3b88def3ce4847bcdf0d6f1f8009748caee
|
[
"MIT"
] | null | null | null |
week3/session2/class_template.cpp
|
horbosis556/CPP20-IntroductoryAssignments
|
efc8a3b88def3ce4847bcdf0d6f1f8009748caee
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
using namespace std;
template <class T>
class Larger {
private:
T first;
T second;
public:
T getFirst();
T getSecond();
void setFirst(T f);
void setSecond(T s);
T isLarger();
};
// your code here
template <class T>
T Larger<T>::getFirst(){
return first;
}
template <class T>
T Larger<T>::getSecond(){
return second;
}
template <class T>
void Larger<T>::setFirst(T f){
first = f;
}
template <class T>
void Larger<T>::setSecond(T s){
second = s;
}
template <class T>
T Larger<T>::isLarger(){
return (first > second) ? first : second;
}
int main() {
Larger<int> l;
int f, s;
cout << "Enter first data " << endl;
cin >> f;
l.setFirst(f);
cout << "Enter second data " << endl;
cin >> s;
l.setSecond(s);
cout << "The larger of " << f << " and " << s << " is " << l.isLarger() << endl;
return 0;
}
| 15.171875
| 82
| 0.544799
|
horbosis556
|
63d5631199b5c65322cea52ebaacbe5b0516e60c
| 390
|
cpp
|
C++
|
codeforces/672/b.cpp
|
AadityaJ/Spoj
|
61664c1925ef5bb072a3fe78fb3dac4fb68d77a1
|
[
"MIT"
] | null | null | null |
codeforces/672/b.cpp
|
AadityaJ/Spoj
|
61664c1925ef5bb072a3fe78fb3dac4fb68d77a1
|
[
"MIT"
] | null | null | null |
codeforces/672/b.cpp
|
AadityaJ/Spoj
|
61664c1925ef5bb072a3fe78fb3dac4fb68d77a1
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[]) {
bool arr[26]={0};
string str;
int n;
cin>>n;
cin>>str;
int unique=0;
for(int i=0;i<str.length();i++){
if(arr[str[i]-'a']==0) unique++;
arr[str[i]-'a']=1;
}
int x=str.size()-unique;
if(x>=26 || n>26) cout<<-1;
else cout<<x;
return 0;
}
| 17.727273
| 40
| 0.602564
|
AadityaJ
|
63d73d707c892a7a78e1ae8a3653607485645493
| 4,508
|
cpp
|
C++
|
testcoasync4cpp/src/test_taskify.cpp
|
helgebetzinger/coasync4cpp
|
a1075948b742852771c5ac8fc893efa42bd87cd8
|
[
"MIT"
] | 24
|
2015-01-25T13:12:06.000Z
|
2020-05-23T14:12:43.000Z
|
testcoasync4cpp/src/test_taskify.cpp
|
helgebetzinger/coasync4cpp
|
a1075948b742852771c5ac8fc893efa42bd87cd8
|
[
"MIT"
] | null | null | null |
testcoasync4cpp/src/test_taskify.cpp
|
helgebetzinger/coasync4cpp
|
a1075948b742852771c5ac8fc893efa42bd87cd8
|
[
"MIT"
] | 2
|
2016-08-11T09:20:34.000Z
|
2020-04-14T03:03:40.000Z
|
#include "stdafx.h"
#include "bind2thread.h"
#include "taskify.h"
class test_taskify : public ::testing::Test {
protected:
test_taskify() {
}
virtual void SetUp() {
thread.reset(new ThreadWithTasks());
}
virtual void TearDown() {
tearDown();
}
void awaitTasksDone() {
thread->sync().get();
}
void tearDown() {
thread->stop();
if (thread->joinable()) {
thread->join();
}
}
TaskDispatcherPtr secondThread() const {
return thread->dispatcher();
}
// DATA
std::shared_ptr<ThreadWithTasks> thread;
};
class TestTaskifyException : public std::exception {
public:
TestTaskifyException(const char * what) : mWhat(what) {
}
#ifdef _GLIBCXX_USE_NOEXCEPT
virtual const char * what() const _GLIBCXX_USE_NOEXCEPT override{
#else
virtual const char * what() const override {
#endif
return mWhat;
}
private:
const char * mWhat;
};
//exception immediatelly
//translate error immediatelly->best practices to link own errors with exception system
static void async_file_sizes_cr( const std::function< void(int) >& foo, int size) {
foo(size);
}
static void async_file_sizes( std::function< void(int) > foo, int size) {
foo(size);
}
static void async_exception(std::function< void(int) > foo, const char* what ) {
throw TestTaskifyException (what);
}
static void async_exception_ptr(std::function< void(int) > foo, std::function< void(const std::exception_ptr&) > onException, const char* what) {
try {
throw TestTaskifyException(what);
}
catch (...) {
onException( std::current_exception());
}
}
static void async_delayed_file_sizes(std::function< void(int) > foo, int size) {
post2current( std::bind(foo, size));
}
static void async_delayed_file_sizes_2nd_thread( const TaskDispatcherPtr& workerThread, const std::function< void(int) >& foo, int size) {
workerThread->postex( bind2current(foo, size));
}
TEST_F(test_taskify, callbackImmediately) {
std::shared_ptr<TaskDispatcher4StdThread> dispatcher(TaskDispatcher4StdThread::create());
post2current([dispatcher] {
make_task([dispatcher]
{
Task< boost::future< std::tuple<int> > > t( taskify( async_file_sizes, placeholders::CALLBACK, 3 ));
size_t sizes = std::get<0>( t.get());
EXPECT_EQ(sizes, 3);
dispatcher->stop();
}
);
});
dispatcher->run();
}
TEST_F(test_taskify, callbackDelayed ) {
std::shared_ptr<TaskDispatcher4StdThread> dispatcher(TaskDispatcher4StdThread::create());
post2current([dispatcher] {
make_task([dispatcher]
{
Task< boost::future< std::tuple<int> > > t(taskify(async_delayed_file_sizes, placeholders::CALLBACK, 4));
size_t sizes = std::get<0>(t.get());
EXPECT_EQ(sizes, 4);
dispatcher->stop();
}
);
});
dispatcher->run();
}
TEST_F(test_taskify, callbackFrom2ndThread ) {
std::shared_ptr<TaskDispatcher4StdThread> dispatcher(TaskDispatcher4StdThread::create());
TaskDispatcherPtr secondThread = this->secondThread();
post2current([dispatcher, secondThread] {
make_task([dispatcher, secondThread]
{
Task< boost::future< std::tuple<int> > > t( taskify( async_delayed_file_sizes_2nd_thread, secondThread, placeholders::CALLBACK, 4));
size_t sizes = std::get<0>(t.get());
EXPECT_EQ(sizes, 4);
dispatcher->stop();
}
);
});
dispatcher->run();
}
TEST_F(test_taskify, exceptionImmediately) {
std::shared_ptr<TaskDispatcher4StdThread> dispatcher(TaskDispatcher4StdThread::create());
post2current([dispatcher] {
make_task([dispatcher]
{
const char *resultingWhat = 0;
std::exception r;
try
{
Task< boost::future< std::tuple<int> > > t(taskify(async_exception, placeholders::CALLBACK, "exceptionImmediately"));
size_t sizes = std::get<0>(t.get());
}
catch (std::exception& e)
{
resultingWhat = e.what();
}
EXPECT_EQ( std::string(resultingWhat), std::string("exceptionImmediately"));
dispatcher->stop();
}
);
});
dispatcher->run();
}
TEST_F(test_taskify, exceptionWithinCallback ) {
std::shared_ptr<TaskDispatcher4StdThread> dispatcher(TaskDispatcher4StdThread::create());
post2current([dispatcher] {
make_task([dispatcher]
{
const char *resultingWhat = 0;
auto&& t( taskify( async_exception_ptr, placeholders::CALLBACK, placeholders::EXCEPTION_PTR, "exceptionWithinCallback" ));
try
{
t.get();
}
catch (std::exception& e)
{
resultingWhat = e.what();
}
EXPECT_EQ(std::string(resultingWhat), std::string("exceptionWithinCallback"));
dispatcher->stop();
}
);
});
dispatcher->run();
}
| 22.427861
| 145
| 0.696318
|
helgebetzinger
|
63d851a4d0292d12a9852cabbb65d9daa1052345
| 10,877
|
cpp
|
C++
|
qt4/immodule/candidatewindow.cpp
|
NgoHuy/uim
|
aac432dc5d698cde6bade0b2fda70c036ba4879a
|
[
"BSD-3-Clause"
] | 1
|
2015-10-25T05:58:57.000Z
|
2015-10-25T05:58:57.000Z
|
qt4/immodule/candidatewindow.cpp
|
NgoHuy/uim
|
aac432dc5d698cde6bade0b2fda70c036ba4879a
|
[
"BSD-3-Clause"
] | null | null | null |
qt4/immodule/candidatewindow.cpp
|
NgoHuy/uim
|
aac432dc5d698cde6bade0b2fda70c036ba4879a
|
[
"BSD-3-Clause"
] | null | null | null |
/*
Copyright (c) 2003-2013 uim Project http://code.google.com/p/uim/
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of authors nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#include "candidatewindow.h"
#include <QtGui/QFontMetrics>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout>
#include <uim/uim-scm.h>
#include "quiminputcontext.h"
#include "subwindow.h"
static const int MIN_CAND_WIDTH = 80;
static const int HEADING_COLUMN = 0;
static const int CANDIDATE_COLUMN = 1;
static const int ANNOTATION_COLUMN = 2;
CandidateWindow::CandidateWindow( QWidget *parent, bool vertical )
: AbstractCandidateWindow( parent ), subWin( 0 ),
hasAnnotation( uim_scm_symbol_value_bool( "enable-annotation?" ) ),
isVertical( vertical )
{
//setup CandidateList
cList = new CandidateListView( 0, isVertical );
cList->setSelectionMode( QAbstractItemView::SingleSelection );
cList->setSelectionBehavior( isVertical
? QAbstractItemView::SelectRows : QAbstractItemView::SelectColumns );
cList->setMinimumWidth( MIN_CAND_WIDTH );
if ( isVertical )
// the last column is dummy for adjusting size.
cList->setColumnCount( hasAnnotation ? 4 : 3 );
else
cList->setRowCount( 2 );
cList->horizontalHeader()->setResizeMode( QHeaderView::ResizeToContents );
cList->horizontalHeader()->setStretchLastSection( true );
if ( !isVertical ) {
cList->verticalHeader()
->setResizeMode( QHeaderView::ResizeToContents );
cList->verticalHeader()->setStretchLastSection( true );
}
cList->horizontalHeader()->hide();
cList->verticalHeader()->hide();
cList->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
cList->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
cList->setAutoScroll( false );
cList->setShowGrid( false );
connect( cList, SIGNAL( cellClicked( int, int ) ),
this , SLOT( slotCandidateSelected( int, int ) ) );
connect( cList, SIGNAL( itemSelectionChanged() ),
this , SLOT( slotHookSubwindow() ) );
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin( 0 );
layout->setSpacing( 0 );
layout->addWidget( cList );
layout->addWidget( numLabel );
setLayout( layout );
}
void CandidateWindow::activateCandwin( int dLimit )
{
AbstractCandidateWindow::activateCandwin( dLimit );
if ( !subWin )
subWin = new SubWindow( this );
}
#if UIM_QT_USE_NEW_PAGE_HANDLING
void CandidateWindow::setNrCandidates( int nrCands, int dLimit )
{
AbstractCandidateWindow::setNrCandidates( nrCands, dLimit );
if ( !subWin )
subWin = new SubWindow( this );
}
#endif /* UIM_QT_USE_NEW_PAGE_HANDLING */
void CandidateWindow::updateView( int newpage, int ncandidates )
{
cList->clearContents();
annotations.clear();
if ( isVertical )
cList->setRowCount( ncandidates );
else
// the last column is dummy for adjusting size.
cList->setColumnCount( ncandidates + 1 );
for ( int i = 0; i < ncandidates ; i++ ) {
uim_candidate cand = stores[ displayLimit * newpage + i ];
QString headString
= QString::fromUtf8( uim_candidate_get_heading_label( cand ) );
QString candString
= QString::fromUtf8( uim_candidate_get_cand_str( cand ) );
QString annotationString;
if ( hasAnnotation ) {
annotationString
= QString::fromUtf8( uim_candidate_get_annotation_str( cand ) );
annotations.append( annotationString );
}
// insert new item to the candidate list
if ( isVertical ) {
QTableWidgetItem *headItem = new QTableWidgetItem;
headItem->setText( headString );
headItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
QTableWidgetItem *candItem = new QTableWidgetItem;
candItem->setText( candString );
candItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
cList->setItem( i, HEADING_COLUMN, headItem );
cList->setItem( i, CANDIDATE_COLUMN, candItem );
if ( hasAnnotation ) {
QTableWidgetItem *annotationItem = new QTableWidgetItem;
annotationItem->setFlags(
Qt::ItemIsSelectable | Qt::ItemIsEnabled );
if ( !annotationString.isEmpty() )
annotationItem->setText( "..." );
cList->setItem( i, ANNOTATION_COLUMN, annotationItem );
}
cList->setRowHeight( i,
QFontMetrics( cList->font() ).height() + 2 );
} else {
QTableWidgetItem *candItem = new QTableWidgetItem;
candItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
QString candText = headString + ": " + candString;
if ( hasAnnotation && !annotationString.isEmpty() )
candText += "...";
candItem->setText( candText );
cList->setItem( 0, i, candItem );
}
}
if ( !isVertical )
cList->setRowHeight( 0, QFontMetrics( cList->font() ).height() + 2 );
}
void CandidateWindow::updateSize()
{
// size adjustment
cList->updateGeometry();
setFixedSize(sizeHint());
}
void CandidateWindow::setIndex( int totalindex )
{
AbstractCandidateWindow::setIndex( totalindex );
// select item
if ( candidateIndex >= 0 ) {
int pos = totalindex;
if ( displayLimit )
pos = candidateIndex % displayLimit;
int row;
int column;
if ( isVertical ) {
row = pos;
column = 0;
} else {
row = 0;
column = pos;
}
if ( cList->item( row, column )
&& !cList->item( row, column )->isSelected() ) {
cList->clearSelection();
if ( isVertical )
cList->selectRow( pos );
else
cList->selectColumn( pos );
}
} else {
cList->clearSelection();
}
updateLabel();
}
void CandidateWindow::slotCandidateSelected( int row, int column )
{
candidateIndex = ( pageIndex * displayLimit )
+ ( isVertical ? row : column );
if ( ic && ic->uimContext() )
uim_set_candidate_index( ic->uimContext(), candidateIndex );
updateLabel();
}
void CandidateWindow::shiftPage( bool forward )
{
AbstractCandidateWindow::shiftPage( forward );
if ( candidateIndex != -1 ) {
cList->clearSelection();
int idx = displayLimit ? candidateIndex % displayLimit : candidateIndex;
if ( isVertical )
cList->selectRow( idx );
else
cList->selectColumn( idx );
}
}
#if UIM_QT_USE_NEW_PAGE_HANDLING
#endif /* UIM_QT_USE_NEW_PAGE_HANDLING */
void CandidateWindow::slotHookSubwindow()
{
if ( !hasAnnotation || !subWin )
return;
QList<QTableWidgetItem *> list = cList->selectedItems();
if ( list.isEmpty() )
return;
QTableWidgetItem *item = list[0];
// cancel previous hook
subWin->cancelHook();
// hook annotation
QString annotationString
= annotations.at( isVertical ? item->row() : item->column() );
if ( !annotationString.isEmpty() ) {
subWin->layoutWindow( subWindowRect( frameGeometry(), item ),
isVertical );
subWin->hookPopup( annotationString );
}
}
// Moving and Resizing affects the position of Subwindow
void CandidateWindow::moveEvent( QMoveEvent *e )
{
// move subwindow
if ( subWin )
subWin->layoutWindow( subWindowRect( QRect( e->pos(), size() ) ),
isVertical );
}
void CandidateWindow::resizeEvent( QResizeEvent *e )
{
// move subwindow
if ( subWin )
subWin->layoutWindow( subWindowRect( QRect( pos(), e->size() ) ),
isVertical );
}
void CandidateWindow::hideEvent( QHideEvent *event )
{
QFrame::hideEvent( event );
if ( subWin )
subWin->cancelHook();
}
QRect CandidateWindow::subWindowRect( const QRect &rect,
const QTableWidgetItem *item )
{
if ( !item ) {
QList<QTableWidgetItem *> list = cList->selectedItems();
if ( list.isEmpty() )
return rect;
item = list[0];
}
QRect r = rect;
if ( isVertical ) {
r.setY( rect.y() + cList->rowHeight( 0 ) * item->row() );
} else {
int xdiff = 0;
for ( int i = 0, j = item->column(); i < j; i++ ) {
xdiff += cList->columnWidth( i );
}
r.setX( rect.x() + xdiff );
}
return r;
}
QSize CandidateWindow::sizeHint() const
{
QSize cListSizeHint = cList->sizeHint();
// According to the Qt4 documentation on the QFrame class,
// the frame width is 1 pixel.
int frame = 1 * 2;
int width = cListSizeHint.width() + frame;
int height = cListSizeHint.height() + numLabel->height() + frame;
return QSize( width, height );
}
QSize CandidateListView::sizeHint() const
{
// frame width
int frame = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ) * 2;
// the size of the dummy row should be 0.
const int rowNum = isVertical ? rowCount() : rowCount() - 1;
if ( rowNum == 0 ) {
return QSize( MIN_CAND_WIDTH, frame );
}
int width = frame;
// the size of the dummy column should be 0.
for ( int i = 0; i < columnCount() - 1; i++ )
width += columnWidth( i );
return QSize( width, rowHeight( 0 ) * rowNum + frame );
}
| 31.991176
| 82
| 0.638136
|
NgoHuy
|
63d8d13350cc5dcd1163255a116ecfefb6f3d232
| 2,389
|
hpp
|
C++
|
source/FAST/Visualization/TriangleRenderer/TriangleRenderer.hpp
|
andreped/FAST
|
361819190ea0ae5a2f068e7bd808a1c70af5a171
|
[
"BSD-2-Clause"
] | null | null | null |
source/FAST/Visualization/TriangleRenderer/TriangleRenderer.hpp
|
andreped/FAST
|
361819190ea0ae5a2f068e7bd808a1c70af5a171
|
[
"BSD-2-Clause"
] | null | null | null |
source/FAST/Visualization/TriangleRenderer/TriangleRenderer.hpp
|
andreped/FAST
|
361819190ea0ae5a2f068e7bd808a1c70af5a171
|
[
"BSD-2-Clause"
] | null | null | null |
#pragma once
#include "FAST/Data/Mesh.hpp"
#include "FAST/Data/Color.hpp"
#include "FAST/Visualization/Renderer.hpp"
namespace fast {
/**
* @brief Renders triangle Mesh data
*
* @ingroup renderers
*/
class FAST_EXPORT TriangleRenderer : public Renderer {
FAST_PROCESS_OBJECT(TriangleRenderer)
public:
/**
* @brief Create instance
* @param color Color of triangles
* @param opacity Triangle opacity
* @param wireframe Display wireframe or not
* @param specularReflection
* @return instance
*/
FAST_CONSTRUCTOR(TriangleRenderer,
Color, color, = Color::Green(),
float, opacity, = 1,
bool, wireframe, = false,
float, specularReflection, = 0.8f
);
uint addInputConnection(DataChannel::pointer port) override;
uint addInputConnection(DataChannel::pointer port, Color color, float opacity);
void setDefaultOpacity(float opacity);
/**
* Enable/disable renderer of wireframe instead of filled polygons
* @param wireframe
*/
void setWireframe(bool wireframe);
void setDefaultColor(Color color);
void setDefaultSpecularReflection(float specularReflection);
void setColor(uint inputNr, Color color);
void setLabelColor(int label, Color color);
void setOpacity(uint inputNr, float opacity);
void setLineSize(int size);
/**
* Ignore inverted normals. This gives a better visualization
* if some normals in a mesh points have opposite direction.
*
* Default: true
* @param ignore
*/
void setIgnoreInvertedNormals(bool ignore);
private:
void draw(Matrix4f perspectiveMatrix, Matrix4f viewingMatrix, float zNear, float zFar, bool mode2D) override;
std::unordered_map<uint, Color> mInputColors;
std::unordered_map<int, Color> mLabelColors;
std::unordered_map<uint, float> mInputOpacities;
std::unordered_map<uint, uint> mVAO;
Color mDefaultColor;
float mDefaultSpecularReflection;
float mDefaultOpacity;
int mLineSize;
bool mWireframe;
bool mDefaultColorSet;
bool mIgnoreInvertedNormals = true;
};
} // namespace fast
| 34.128571
| 117
| 0.628296
|
andreped
|
63dcc4615f116e8340a56350d7e50703e480b12f
| 527
|
cpp
|
C++
|
Bootcamp/Practice/bubbleSort.cpp
|
sgpritam/DSAlgo
|
3e0e6b19d4f8978b2fc3be48195705a285dbdce8
|
[
"MIT"
] | 1
|
2020-03-06T21:05:14.000Z
|
2020-03-06T21:05:14.000Z
|
Bootcamp/Session7/bubbleSort.cpp
|
sgpritam/DSAlgo
|
3e0e6b19d4f8978b2fc3be48195705a285dbdce8
|
[
"MIT"
] | 2
|
2020-03-09T05:08:14.000Z
|
2020-03-09T05:14:09.000Z
|
Bootcamp/Session7/bubbleSort.cpp
|
sgpritam/DSAlgo
|
3e0e6b19d4f8978b2fc3be48195705a285dbdce8
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
void bubbleSort(int a[],int n){
// Base case
if(n==1){
return;
}
for(int j=0;j<=n-2;j++){
if(a[j]>a[j+1]){
swap(a[j],a[j+1]);
}
}
bubbleSort(a,n-1);
}
int main(){
int n;
cin>>n;
int a[1000];
for(int i=0;i<n;i++){
cin>>a[i];
}
bubbleSort(a,n);
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
}
| 15.057143
| 34
| 0.345351
|
sgpritam
|
63de33f64626b5f62587e6aa54d8589f4fa72c85
| 735
|
cpp
|
C++
|
Before Summer 2017/SummerTrain Archieve/Amusing_num.cpp
|
mohamedGamalAbuGalala/Practice
|
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
|
[
"MIT"
] | 1
|
2019-12-19T06:51:20.000Z
|
2019-12-19T06:51:20.000Z
|
Before Summer 2017/SummerTrain Archieve/Amusing_num.cpp
|
mohamedGamalAbuGalala/Practice
|
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
|
[
"MIT"
] | null | null | null |
Before Summer 2017/SummerTrain Archieve/Amusing_num.cpp
|
mohamedGamalAbuGalala/Practice
|
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
// Amusing_num.cpp : Defines the entry point for the console application.
//by :: bu galala
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n, inp[1000], dignum;
string res[1000], cur = "";
int main() {
cin >> n;
for (int i = 0; i < n && cin >> inp[i]; i++);
for (int i = 0; i < n; i++) {
int key = inp[i], j;
dignum = 1;
cur = res[i];
for (j = 1; key > pow(2, j); j++)
key -= pow(2, j);
dignum = j;
int tmp = dignum;
while (cur.size() < tmp) {
dignum--;
if (key <= pow(2, dignum))
cur += '5';
else {
cur += '6';
key -= pow(2, dignum);
}
}
res[i] = cur;
}
for (int i = 0; i < n && cout << res[i] << endl; i++);
return 0;
}
| 18.846154
| 73
| 0.517007
|
mohamedGamalAbuGalala
|
63e04841316739392e8bf6d8c0df6a340d9803db
| 111,157
|
cpp
|
C++
|
GameServer/MuunSystem.cpp
|
millerp/IGC.GameServer
|
0f67ec22d747a84d5934493939cada88a4e067db
|
[
"MIT"
] | 2
|
2017-03-09T09:42:59.000Z
|
2020-11-18T07:58:58.000Z
|
GameServer/MuunSystem.cpp
|
millerp/IGC.GameServer
|
0f67ec22d747a84d5934493939cada88a4e067db
|
[
"MIT"
] | 8
|
2017-03-08T13:26:53.000Z
|
2017-03-09T13:37:43.000Z
|
GameServer/MuunSystem.cpp
|
millerp/IGC.GameServer
|
0f67ec22d747a84d5934493939cada88a4e067db
|
[
"MIT"
] | 5
|
2017-11-21T13:22:52.000Z
|
2022-02-17T07:41:34.000Z
|
#include "StdAfx.h"
#include "protocol.h"
#include "TLog.h"
#include "DSProtocol.h"
#include "GameMain.h"
#include "ItemSocketOptionSystem.h"
#include "PentagramSystem.h"
#include "winutil.h"
#include "NewPVP.h"
#include "ObjCalCharacter.h"
#include "MuunSystem.h"
#include "configread.h"
#include "gObjMonster.h"
#include "ItemOptionTypeMng.h"
#include "GensSystem.h"
#include "LargeRand.h"
#include "BuffEffectSlot.h"
#include "ImperialGuardian.h"
#include "BattleSoccerManager.h"
#include "AcheronGuardianEvent.h"
#include "ObjAttack.h"
#include "ChaosCastle.h"
#include "OfflineLevelling.h"
#include "LastManStanding.h"
CMuunAttack::CMuunAttack() {
}
CMuunAttack::~CMuunAttack() {
}
void CMuunAttack::SendAttackMsg(int aIndex, int aTargetIndex, int SubCode, int SubCode2) {
if (SubCode == MUUN_DEC_ENEMY_ATTACK_SKILL) {
aTargetIndex = aIndex;
}
if (SubCode == MUUN_ATTACK_SKILL || SubCode == MUUN_ATTACK_SKILL_2 || SubCode == MUUN_ATTACK_SKILL_NONPVP) {
if (gObjCalDistance(&gObj[aIndex], &gObj[aTargetIndex]) > 4) {
g_CMuunSystem.ReSetTarget(&gObj[aIndex], aTargetIndex);
return;
}
if (gObj[aTargetIndex].Life <= 0.0) {
g_CMuunSystem.ReSetTarget(&gObj[aIndex], aTargetIndex);
return;
}
if (SubCode == MUUN_ATTACK_SKILL_NONPVP) {
if (gObj[aTargetIndex].Type == OBJ_USER) {
g_CMuunSystem.ReSetTarget(&gObj[aIndex], aTargetIndex);
return;
}
}
}
if (SubCode != MUUN_DEC_ENEMY_ATTACK_SKILL) {
PMSG_MUUN_ATTACK_COMMAND pMsg;
pMsg.Slot = SubCode2;
pMsg.SkillType = SubCode;
pMsg.NumberH = HIBYTE(aIndex);
pMsg.NumberL = LOBYTE(aIndex);
pMsg.TargetNumberH = HIBYTE(aTargetIndex);
pMsg.TargetNumberL = LOBYTE(aTargetIndex);
pMsg.h.set((LPBYTE) & pMsg, 0x4E, 0x12, sizeof(pMsg));
IOCP.DataSend(aIndex, (LPBYTE) & pMsg, pMsg.h.size);
GSProtocol.MsgSendV2(&gObj[aIndex], (LPBYTE) & pMsg, pMsg.h.size);
}
gObjAddAttackProcMsgSendDelay(&gObj[aIndex], 63, aTargetIndex, 600, SubCode, SubCode2);
}
void CMuunAttack::SkillProc(LPOBJ lpObj) {
for (int i = 0; i < MAX_MUUN_EFFECT_LIST; i++) {
if (lpObj->pMuunInventory[i].m_Durability > 0.0 &&
lpObj->m_MuunEffectList[i].bOptEnable == true &&
(lpObj->m_MuunEffectList[i].nOptType == MUUN_ATTACK_SKILL ||
lpObj->m_MuunEffectList[i].nOptType == MUUN_DEC_ENEMY_ATTACK_SKILL ||
lpObj->m_MuunEffectList[i].nOptType == MUUN_ATTACK_SKILL_2 ||
lpObj->m_MuunEffectList[i].nOptType == MUUN_ATTACK_SKILL_NONPVP)) {
DWORD dwSkillDelayTime = lpObj->m_MuunEffectList[i].nSkillDelayTime;
int nTargetIndex = lpObj->m_MuunEffectList[i].nTargetIndex;
if (nTargetIndex >= 0 || (lpObj->m_MuunEffectList[i].nOptType != MUUN_ATTACK_SKILL &&
lpObj->m_MuunEffectList[i].nOptType != MUUN_ATTACK_SKILL_2 &&
lpObj->m_MuunEffectList[i].nOptType != MUUN_ATTACK_SKILL_NONPVP)) {
if (g_GensSystem.IsPkEnable(lpObj, &gObj[nTargetIndex]) == FALSE) {
return;
}
if ((MapC[gObj[nTargetIndex].MapNumber].GetAttr(gObj[nTargetIndex].X, gObj[nTargetIndex].Y) & 1) == 1) {
g_CMuunSystem.ReSetTarget(lpObj, nTargetIndex);
return;
}
if ((MapC[lpObj->MapNumber].GetAttr(lpObj->X, lpObj->Y) & 1) == 1) {
g_CMuunSystem.ReSetTarget(lpObj, nTargetIndex);
return;
}
if (lpObj->pMuunInventory[i].IsMuunItemPeriodExpire() == FALSE &&
lpObj->m_MuunEffectList[i].nAddOptType == 3) {
dwSkillDelayTime /= lpObj->m_MuunEffectList[i].nAddOptValue;
}
if (GetTickCount() - lpObj->m_MuunEffectList[i].nTickTime > dwSkillDelayTime) {
lpObj->m_MuunEffectList[i].nTickTime = GetTickCount();
this->SendAttackMsg(lpObj->m_Index, nTargetIndex, lpObj->m_MuunEffectList[i].nOptType, i);
}
}
}
}
}
bool CMuunAttack::DamageAbsorb(LPOBJ lpObj, LPOBJ lpTargetObj, CMagicInf *lpMagic, int SubCode2) {
lpObj->m_MuunEffectList[SubCode2].bSkillUsed = false;
return true;
}
bool CMuunAttack::Stun(LPOBJ lpObj, LPOBJ lpTargetObj, CMagicInf *lpMagic, int SubCode2) {
int iValue = lpObj->m_MuunEffectList[SubCode2].nOptValue;
int iStunRate = iValue;
if (lpTargetObj->Type == OBJ_USER) {
iStunRate -= lpTargetObj->m_PlayerData->m_Resistance_Stun;
}
if (GetLargeRand() % 1000000 <= iStunRate) {
gObjAddBuffEffect(lpTargetObj, BUFFTYPE_STUN, 0, 0, 0, 0, 2);
gObjSetPosition(lpTargetObj->m_Index, lpTargetObj->X, lpTargetObj->Y);
}
return true;
}
bool CMuunAttack::Attack(LPOBJ lpObj, LPOBJ lpTargetObj, CMagicInf *lpMagic, int SubCode2) {
int skillSuccess = 0;
LPOBJ lpCallObj;
LPOBJ lpCallTargetObj;
int MsgDamage = 0;
int ManaChange = 0;
int iTempShieldDamage = 0;
int iTotalShieldDamage = 0;
if ((lpObj->Authority & 2) == 2 || (lpTargetObj->Authority & 2) == 2) //s4 add-on
{
return FALSE;
}
if ((lpObj->Authority & 32) == 32 || (lpTargetObj->Authority & 32) == 32) //s4 add-on
{
if (gObjCheckUsedBuffEffect(lpObj, BUFFTYPE_INVISABLE) == TRUE) {
return FALSE;
}
if (gObjCheckUsedBuffEffect(lpTargetObj, BUFFTYPE_INVISABLE) == TRUE) {
return FALSE;
}
}
if (lpObj->MapNumber != lpTargetObj->MapNumber) {
return FALSE;
}
if (lpTargetObj->m_bOffLevel == true && g_OffLevel.m_General.Immortal == 1) {
return FALSE;
}
if (IMPERIAL_MAP_RANGE(lpObj->MapNumber) == TRUE &&
g_ImperialGuardian.IsAttackAbleMonster(lpTargetObj->m_Index) == false) {
return FALSE;
}
if (g_ConfigRead.server.GetServerType() == SERVER_CASTLE) {
if (g_Crywolf.GetCrywolfState() == 3 || g_Crywolf.GetCrywolfState() == 5) {
if (CRYWOLF_MAP_RANGE(lpTargetObj->MapNumber)) {
if (lpTargetObj->Type == OBJ_MONSTER) {
return FALSE;
}
}
}
}
int skill = 0;
if (lpMagic)
skill = lpMagic->m_Skill;
skillSuccess = TRUE;
if (lpObj->m_PlayerData->GuildNumber > 0) {
if (lpObj->m_PlayerData->lpGuild) {
if (lpObj->m_PlayerData->lpGuild->WarState) {
if (lpObj->m_PlayerData->lpGuild->WarType == 1) {
if (!GetBattleSoccerGoalMove(0)) {
return TRUE;
}
}
}
}
}
if (lpTargetObj->Type == OBJ_MONSTER) {
if (lpTargetObj->Class == 200) {
if (skill) {
gObjMonsterStateProc(lpTargetObj, 7, lpObj->m_Index, 0);
} else {
gObjMonsterStateProc(lpTargetObj, 6, lpObj->m_Index, 0);
}
return TRUE;
}
}
if (lpObj->Type == OBJ_USER) {
if (!gObjIsConnected(lpObj)) {
return FALSE;
}
}
if (lpTargetObj->Type == OBJ_USER) {
if (!gObjIsConnected(lpTargetObj)) {
return FALSE;
}
}
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_MONSTER) // PLAYER VS MONSTER
{
if (lpObj->m_RecallMon >= 0) {
if (lpObj->m_RecallMon == lpTargetObj->m_Index) {
return FALSE;
}
}
}
if (g_ConfigRead.antihack.EnableAttackBlockInSafeZone == TRUE) {
BYTE btAttr = MapC[lpObj->MapNumber].GetAttr(lpObj->X, lpObj->Y);
if ((btAttr & 1) == 1) {
return FALSE;
}
}
if (!gObjAttackQ(lpTargetObj)) {
return FALSE;
}
if (g_ArcaBattle.IsArcaBattleServer() == TRUE && g_AcheronGuardianEvent.IsPlayStart() == false &&
g_ArcaBattle.IsEnableAttackObelisk(lpObj, lpTargetObj->Class) == false) {
return FALSE;
}
if (lpTargetObj->Type == OBJ_USER && g_NewPVP.IsDuel(*lpTargetObj) && g_NewPVP.IsSafeState(*lpTargetObj)) {
return FALSE;
}
if (lpObj->Type == OBJ_USER && g_NewPVP.IsDuel(*lpObj) && g_NewPVP.IsSafeState(*lpObj)) {
return FALSE;
}
if (lpTargetObj->Type == OBJ_USER && g_NewPVP.IsObserver(*lpTargetObj)) {
return FALSE;
}
if (lpObj->Type == OBJ_USER && g_NewPVP.IsObserver(*lpObj)) {
return FALSE;
}
if (g_ConfigRead.server.GetServerType() == SERVER_CASTLE) {
if (g_CastleSiege.GetCastleState() == CASTLESIEGE_STATE_STARTSIEGE) {
if (lpObj->m_btCsJoinSide > 0) {
if (lpObj->m_btCsJoinSide == lpTargetObj->m_btCsJoinSide) {
return FALSE;
}
}
}
}
lpObj->m_TotalAttackCount++;
if (this->CheckAttackArea(lpObj, lpTargetObj) == FALSE) {
return FALSE;
}
lpCallObj = lpObj;
lpCallTargetObj = lpTargetObj;
if (lpTargetObj->Type == OBJ_MONSTER) {
if (lpTargetObj->m_RecallMon >= 0) {
lpCallTargetObj = &gObj[lpTargetObj->m_RecallMon];
}
}
if (this->PkCheck(lpCallObj, lpTargetObj) == FALSE) {
return FALSE;
}
BOOL bIsOnDuel = gObjDuelCheck(lpObj, lpTargetObj);
if (bIsOnDuel) {
lpObj->m_iDuelTickCount = GetTickCount();
lpTargetObj->m_iDuelTickCount = GetTickCount();
}
int iOriginTargetDefense = 0;
int targetdefense = this->GetTargetDefense(lpObj, lpTargetObj, MsgDamage, iOriginTargetDefense);
if (iOriginTargetDefense > 0) {
targetdefense = iOriginTargetDefense;
}
int AttackDamage = this->GetAttackDamage(lpObj, targetdefense, SubCode2, lpTargetObj);
if (lpTargetObj->DamageMinus) {
int beforeDamage = AttackDamage;
AttackDamage -= ((AttackDamage * (int) lpTargetObj->DamageMinus) / 100);
}
int tlevel = lpObj->Level / 10;
if (AttackDamage < tlevel) {
if (tlevel < 1) {
tlevel = 1;
}
AttackDamage = tlevel;
}
if (lpTargetObj->m_SkillNumber == 18) {
if (AttackDamage > 1) {
AttackDamage >>= 1;
}
}
if (gObjAngelSprite(lpTargetObj) == TRUE) {
if (AttackDamage > 1) {
float damage = (AttackDamage * 8) / 10.0f;
AttackDamage = damage;
}
}
if (gObjWingSprite(lpTargetObj) == TRUE) {
CItem *Wing = &lpTargetObj->pInventory[7];
if (AttackDamage > 1 && Wing->m_Type != ITEMGET(13, 30)) {
double WingDamageBlock;
if (lpTargetObj->m_PlayerData->m_MPSkillOpt.iMpsAddWingDamageBlock <= 0.0) {
WingDamageBlock = 0.0;
} else {
WingDamageBlock = lpTargetObj->m_PlayerData->m_MPSkillOpt.iMpsAddWingDamageBlock;
}
g_ConfigRead.m_ItemCalcLua.Generic_Call("Wings_CalcAbsorb", "iiid>i", AttackDamage, Wing->m_Type,
Wing->m_Level, WingDamageBlock, &AttackDamage);
}
}
if (gObjDenorantSprite(lpTargetObj)) {
CItem *Dinorant = &lpTargetObj->pInventory[8];
int dinorantdecdamage = 90 - Dinorant->IsDinorantReduceAttackDamaege();
lpObj->Life -= 1.0f;
if (lpObj->Life < 0.0f) {
lpObj->Life = 0.0f;
} else {
AttackDamage = AttackDamage * dinorantdecdamage / 100;
}
GSProtocol.GCReFillSend(lpObj->m_Index, lpObj->Life, 0xFF, 0, lpObj->iShield);
}
if (gObjDarkHorse(lpTargetObj)) {
CItem *Darkhorse = &lpTargetObj->pInventory[8];
int decdamage = 100 - ((Darkhorse->m_PetItem_Level + 30) / 2);
lpTargetObj->Life -= 1.0f;
if (lpTargetObj->Life < 0.0f) {
lpTargetObj->Life = 0.0f;
} else {
AttackDamage = AttackDamage * decdamage / 100;
}
GSProtocol.GCReFillSend(lpTargetObj->m_Index, lpTargetObj->Life, 0xFF, 0, lpTargetObj->iShield);
}
if (AttackDamage > 1) {
int nMuunItemEffectValue = 0;
if (g_CMuunSystem.GetMuunItemValueOfOptType(lpTargetObj, MUUN_DEC_ENEMY_ATTACK_SKILL, &nMuunItemEffectValue,
0) == TRUE) {
AttackDamage = AttackDamage * (100 - nMuunItemEffectValue) / 100;
}
}
if (lpTargetObj->Live) {
if (lpTargetObj->m_SkillInfo.SoulBarrierDefence && AttackDamage > 0) {
int replacemana = (WORD) lpTargetObj->Mana * 2 / 100;
if (replacemana < lpTargetObj->Mana) {
lpTargetObj->Mana -= replacemana;
int decattackdamage = AttackDamage * lpTargetObj->m_SkillInfo.SoulBarrierDefence / 100;
AttackDamage -= decattackdamage;
ManaChange = TRUE;
}
}
if (g_ShieldSystemOn == FALSE) {
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
if (CC_MAP_RANGE(lpObj->MapNumber) && CC_MAP_RANGE(lpTargetObj->MapNumber)) {
AttackDamage = AttackDamage * 50 / 100;
}
}
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
if (lpObj->MapNumber == MAP_INDEX_CHAOSCASTLE_SURVIVAL &&
lpTargetObj->MapNumber == MAP_INDEX_CHAOSCASTLE_SURVIVAL) {
AttackDamage = AttackDamage * 50 / 100;
}
}
}
if (g_ConfigRead.server.GetServerType() == SERVER_CASTLE) {
if (g_CastleSiege.GetCastleState() == CASTLESIEGE_STATE_STARTSIEGE) {
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
if (lpObj->MapNumber == MAP_INDEX_CASTLESIEGE && lpTargetObj->MapNumber == MAP_INDEX_CASTLESIEGE) {
if (lpObj->m_btCsJoinSide == lpTargetObj->m_btCsJoinSide) {
AttackDamage = AttackDamage * g_CastleSiege.CastleSiegeSelfDmgReductionPercent / 100;
} else if (g_ShieldSystemOn == FALSE) {
AttackDamage = AttackDamage * g_CastleSiege.CastleSiegeDmgReductionPercent / 100;
}
}
}
}
}
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_MONSTER) {
if (lpTargetObj->Class == 283) {
if (gObjCheckUsedBuffEffect(lpObj, BUFFTYPE_BLESS_POTION) == TRUE ||
gObjCheckUsedBuffEffect(lpObj, BUFFTYPE_SOUL_POTION) == TRUE) {
AttackDamage += (AttackDamage * 20) / 100;
} else {
if (lpObj->m_iAccumulatedDamage > 100) {
gObjWeaponDurDownInCastle(lpObj, lpTargetObj, 1);
lpObj->m_iAccumulatedDamage = 0;
} else {
lpObj->m_iAccumulatedDamage += AttackDamage;
}
AttackDamage = AttackDamage * 20 / 100;
}
}
if (lpTargetObj->Class == 277) {
if (gObjCheckUsedBuffEffect(lpObj, BUFFTYPE_BLESS_POTION) == TRUE ||
gObjCheckUsedBuffEffect(lpObj, BUFFTYPE_SOUL_POTION) == TRUE) {
AttackDamage += (AttackDamage * 20) / 100;
} else {
if (lpObj->m_iAccumulatedDamage > 100) {
gObjWeaponDurDownInCastle(lpObj, lpTargetObj, 1);
lpObj->m_iAccumulatedDamage = 0;
} else {
lpObj->m_iAccumulatedDamage += AttackDamage;
}
AttackDamage = AttackDamage * 20 / 100;
}
}
}
if (bIsOnDuel == TRUE) {
AttackDamage = AttackDamage * g_NewPVP.m_iDuelDamageReduction / 100;
}
if (g_GensSystem.IsMapBattleZone(lpObj->MapNumber) && g_GensSystem.IsMapBattleZone(lpTargetObj->MapNumber)) {
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
if (g_GensSystem.IsPkEnable(lpObj, lpTargetObj) == true) {
AttackDamage = AttackDamage * g_GensSystem.GetDamageReduction() / 100;
}
}
}
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
AttackDamage = AttackDamage * g_ConfigRead.calc.PvPDamageRate[lpObj->Class][lpTargetObj->Class] / 100;
} else if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_MONSTER) {
AttackDamage = AttackDamage * g_ConfigRead.calc.PvMDamageRate[lpObj->Class] / 100;
}
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
iTempShieldDamage = this->GetShieldDamage(lpObj, lpTargetObj, AttackDamage);
lpTargetObj->iShield -= iTempShieldDamage;
lpTargetObj->Life -= AttackDamage - iTempShieldDamage;
iTotalShieldDamage += iTempShieldDamage;
if (lpTargetObj->Life < 0.0f) {
lpTargetObj->Life = 0.0f;
}
} else {
lpTargetObj->Life -= AttackDamage;
if (lpTargetObj->Life < 0.0f) {
lpTargetObj->Life = 0.0f;
}
}
}
if (lpTargetObj->Type == OBJ_MONSTER) {
gObjAddMsgSendDelay(lpTargetObj, 0, lpObj->m_Index, 100, 0);
lpTargetObj->LastAttackerID = lpObj->m_Index;
if (lpTargetObj->m_iCurrentAI) {
lpTargetObj->m_Agro->IncAgro(lpObj->m_Index, AttackDamage / 100);
}
}
BOOL selfdefense = 0;
lpCallObj = lpTargetObj;
if (lpTargetObj->Type == OBJ_MONSTER) {
if (lpTargetObj->m_RecallMon >= 0) {
lpCallObj = &gObj[lpTargetObj->m_RecallMon];
}
}
if (AttackDamage >= 1) {
if (lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) {
if (gObjDuelCheck(lpObj, lpTargetObj)) {
selfdefense = 0;
} else if (lpObj->m_PlayerData->RegisterdLMS == 1 && lpTargetObj->m_PlayerData->RegisterdLMS == 1) {
if (lpObj->MapNumber == g_LastManStanding.m_Cfg.iPVPMap) {
if (g_LastManStanding.m_Rooms[lpObj->m_PlayerData->RegisteredLMSRoom].bState == 3) {
selfdefense = 0;
}
}
} else if (CC_MAP_RANGE(lpObj->MapNumber) || CC_MAP_RANGE(lpTargetObj->MapNumber)) {
selfdefense = 0;
} else if (lpObj->MapNumber == MAP_INDEX_CHAOSCASTLE_SURVIVAL ||
lpTargetObj->MapNumber == MAP_INDEX_CHAOSCASTLE_SURVIVAL) {
selfdefense = 0;
} else if (IT_MAP_RANGE(lpObj->MapNumber) || IT_MAP_RANGE(lpTargetObj->MapNumber)) {
selfdefense = 0;
} else if (g_GensSystem.IsMapBattleZone(lpObj->MapNumber) &&
g_GensSystem.IsMapBattleZone(lpTargetObj->MapNumber)) {
selfdefense = 0;
} else if (g_ArcaBattle.IsArcaBattleServer() == TRUE) {
selfdefense = 0;
} else {
selfdefense = 1;
}
if (gObjGetRelationShip(lpObj, lpTargetObj) == 2) {
selfdefense = FALSE;
}
if (g_ConfigRead.server.GetServerType() == SERVER_CASTLE) {
if (g_CastleSiege.GetCastleState() == CASTLESIEGE_STATE_STARTSIEGE) {
if (lpObj->m_btCsJoinSide > 0) {
selfdefense = FALSE;
}
}
}
} else if (lpTargetObj->Type == OBJ_MONSTER && lpObj->Type == OBJ_USER) {
if (lpTargetObj->m_RecallMon >= 0) {
selfdefense = TRUE;
}
}
if (lpTargetObj->Type == OBJ_USER) {
gObjArmorRandomDurDown(lpTargetObj, lpObj);
}
}
if (selfdefense == TRUE) {
if (!gObjTargetGuildWarCheck(lpObj, lpCallObj)) {
if (lpCallObj->PartyNumber >= 0) {
int number = 0;
int partynum = lpCallObj->PartyNumber;
if ((gParty.GetPKPartyPenalty(partynum)) < 5) {
gObjCheckSelfDefense(lpObj, lpCallObj->m_Index);
}
} else {
gObjCheckSelfDefense(lpObj, lpCallObj->m_Index);
}
}
}
if (lpObj->Type == OBJ_USER) {
if (lpObj->m_Change == 9) {
GSProtocol.GCMagicAttackNumberSend(lpObj, 3, lpTargetObj->m_Index, 1);
}
}
lpObj->m_Rest = 0;
if (AttackDamage > 0) {
int atd_reflect = (int) ((float) AttackDamage * lpTargetObj->DamageReflect / 100.0f);
if (lpTargetObj->DamageReflect > g_ConfigRead.calc.ReflectDamage) {
lpTargetObj->DamageReflect = g_ConfigRead.calc.ReflectDamage;
}
if (atd_reflect) {
gObjAddMsgSendDelay(lpTargetObj, 10, lpObj->m_Index, 10, atd_reflect);
}
if (lpObj->Type == OBJ_USER && (rand() % 100) < lpObj->m_PlayerData->SetOpReflectionDamage) {
gObjAddMsgSendDelay(lpTargetObj, 10, lpObj->m_Index, 10, AttackDamage);
}
if (g_ShieldSystemOn == TRUE) // #error Remove the //
{
AttackDamage -= iTotalShieldDamage;
}
gObjLifeCheck(lpTargetObj, lpObj, AttackDamage, 0, 0, MsgDamage, skill, iTotalShieldDamage, 0);
} else {
GSProtocol.GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, MsgDamage, 0);
}
if (lpObj->Life <= 0.0f && lpObj->Type == OBJ_USER) {
if (lpObj->m_CheckLifeTime <= 0) {
lpObj->lpAttackObj = lpTargetObj;
if (lpTargetObj->Type == OBJ_USER) {
lpObj->m_bAttackerKilled = true;
} else {
lpObj->m_bAttackerKilled = false;
}
lpObj->m_CheckLifeTime = 3;
}
}
return TRUE;
}
int CMuunAttack::GetAttackDamage(LPOBJ lpObj, int targetDefense, int SubCode2, LPOBJ lpTargetObj) {
int ad = 0;
int AttackDamage =
lpObj->m_MuunEffectList[SubCode2].nOptValue * (lpObj->m_PlayerData->MasterLevel + lpObj->Level) + 10;
if (lpTargetObj->Type == OBJ_USER) {
ad = AttackDamage / 2 - targetDefense;
} else {
ad = AttackDamage - targetDefense;
}
return ad;
}
int CMuunAttack::GetShieldDamage(LPOBJ lpObj, LPOBJ lpTargetObj, int iAttackDamage) {
if (g_ShieldSystemOn == FALSE)
return 0;
if (iAttackDamage <= 0)
return 0;
if (lpObj->Type != OBJ_USER)
return 0;
if (lpTargetObj->Type != OBJ_USER)
return 0;
int iReduceLife = 0;
int iReduceShield = 0;
int iReduceLifeForEffect = 0;
bool bReduceShieldGage = 0;
int iDamageDevideToSDRate = g_iDamageDevideToSDRate;
iDamageDevideToSDRate -= lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpDecreaseSDRate;
iDamageDevideToSDRate += lpTargetObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddSDRate;
if (iDamageDevideToSDRate < 0)
iDamageDevideToSDRate = 0;
if (iDamageDevideToSDRate > 100)
iDamageDevideToSDRate = 100;
if (lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddIgnoreSDRate > 0) {
int iRand = rand() % 100;
int iIgnoreSDRate = lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddIgnoreSDRate -
lpTargetObj->m_PlayerData->m_Resistance_SD;
if (iRand < iIgnoreSDRate) {
iDamageDevideToSDRate = 0;
}
}
if ((lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER) &&
(lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpDecreaseSDRate ||
lpTargetObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddSDRate ||
lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddIgnoreSDRate)) {
g_Log.Add(
"[JewelOfHarmony][PvP System] Attacker:[%s][%s]-SD Decrease[%d] SD Ignore[%d] Defender:[%s][%s] SD Increase Option[%d] - SD Rate[%d]",
lpObj->AccountID, lpObj->Name,
lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpDecreaseSDRate,
lpObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddIgnoreSDRate, lpTargetObj->AccountID,
lpTargetObj->Name, lpTargetObj->m_PlayerData->m_JewelOfHarmonyEffect.HJOpAddSDRate,
iDamageDevideToSDRate);
}
iReduceShield = iAttackDamage * iDamageDevideToSDRate / 100;
iReduceLife = iAttackDamage - iReduceShield;
if ((lpTargetObj->iShield - iReduceShield) < 0) {
iReduceLife += iReduceShield - lpTargetObj->iShield;
iReduceShield = lpTargetObj->iShield;
if (lpTargetObj->iShield > 0) {
bReduceShieldGage = true;
}
}
iReduceLifeForEffect = (lpTargetObj->MaxLife + lpTargetObj->AddLife) * 20.0f / 100.0f;
if (bReduceShieldGage == true && iReduceLife > iReduceLifeForEffect) {
if (!CC_MAP_RANGE(lpTargetObj->MapNumber) && lpTargetObj->MapNumber != MAP_INDEX_CHAOSCASTLE_SURVIVAL) {
GSProtocol.GCSendEffectInfo(lpTargetObj->m_Index, 17);
}
}
return iReduceShield;
}
CMuunSystem g_CMuunSystem;
CMuunSystem::CMuunSystem() {
}
CMuunSystem::~CMuunSystem() {
if (this->m_MuunItemPeriodData != NULL) {
delete[] this->m_MuunItemPeriodData;
}
}
void CMuunSystem::Initialize() {
if (this->m_MuunItemPeriodData != NULL) {
delete[] this->m_MuunItemPeriodData;
}
this->m_MuunItemPeriodData = new MUUN_ITEM_PERIOD_DATA[g_ConfigRead.server.GetObjectMaxUser()];
for (int i = 0; i < g_ConfigRead.server.GetObjectMaxUser(); i++) {
this->m_MuunItemPeriodData[i].Clear();
}
}
bool CMuunSystem::LoadScriptMuunSystemInfo(char *lpszFileName) {
return this->m_MuunInfoMng.LoadScriptMuunSystemInfo(lpszFileName);
}
bool CMuunSystem::LoadScriptMuunSystemOption(char *lpszFileName) {
return this->m_MuunInfoMng.LoadScriptMuunSystemOption(lpszFileName);
}
void CMuunSystem::MuunItemDamage(OBJECTSTRUCT *lpObj, int damage) {
if (g_ConfigRead.pet.DamageDisableForPet[DAMAGE_OFF_MUUN] == true) {
return;
}
if (lpObj->Type != OBJ_USER && (double) damage > 0.0) {
return;
}
if (damage <= 0) {
return;
}
for (int i = 0; i < 2; i++) {
float fdamage = (float) damage;
if (lpObj->pMuunInventory[i].IsItem() == TRUE && lpObj->pMuunInventory[i].m_Durability > 0.0) {
fdamage = fdamage + fdamage;
fdamage = fdamage / 400.0;
fdamage = fdamage / 400.0;
lpObj->pMuunInventory[i].m_Durability -= fdamage;
if (lpObj->pMuunInventory[i].m_Durability != 0.0) {
GSProtocol.GCMuunItemDurSend(lpObj->m_Index, i, lpObj->pMuunInventory[i].m_Durability);
}
if (lpObj->pMuunInventory[i].m_Durability < 1.0) {
lpObj->pMuunInventory[i].m_Durability = 0.0;
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[i].nOptType);
}
}
}
}
BOOL CMuunSystem::MuunItemEquipment(int aIndex, int iPos, int iSource) {
LPOBJ lpObj = &gObj[aIndex];
if (gObj[aIndex].Type != OBJ_USER) {
return FALSE;
}
if (iPos >= 2) {
if (iSource < 2 && iSource != -1 && lpObj->pMuunInventory[iSource].IsItem() == FALSE) {
if (!iSource) {
lpObj->m_wMuunItem = -1;
} else if (iSource == 1) {
lpObj->m_wMuunSubItem = -1;
}
this->RemoveUserMuunEffect(lpObj, iSource);
this->GCSendConditionStatus(aIndex, iSource, 0);
GSProtocol.GCMuunEquipmentChange(lpObj->m_Index, iSource);
}
} else {
if (lpObj->pMuunInventory[iPos].IsItem() == TRUE) {
WORD nItemNum = lpObj->pMuunInventory[iPos].m_Type;
if (iPos == 0) {
lpObj->m_wMuunItem = ITEM_GET_INDEX(lpObj->pMuunInventory[iPos].m_Type) +
(((ITEM_GET_TYPE(lpObj->pMuunInventory[iPos].m_Type)) |
(0x10 * lpObj->pMuunInventory[iPos].m_Level)) << 9);
} else if (iPos == 1) {
lpObj->m_wMuunSubItem = ITEM_GET_INDEX(lpObj->pMuunInventory[iPos].m_Type) +
(((ITEM_GET_TYPE(lpObj->pMuunInventory[iPos].m_Type)) |
(0x10 * lpObj->pMuunInventory[iPos].m_Level)) << 9);
}
this->SetUserMuunEffect(lpObj, nItemNum, lpObj->pMuunInventory[iPos].m_Level, iPos);
this->CheckEquipMuunItemCondition(lpObj);
}
}
return FALSE;
}
void CMuunSystem::SetMuunItemAddPeriodData(OBJECTSTRUCT *lpObj, int iMuunItemNum, UINT64 dwSerial) {
CMuunInfo *pCMuunInfo = this->m_MuunInfoMng.GetMuunItemNumToMuunInfo(iMuunItemNum);
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] pCMuunInfo is NULL [%s][%s]", lpObj->AccountID, lpObj->Name);
return;
}
pCMuunInfo->GetIndex();
pCMuunInfo->GetAddOptStart();
pCMuunInfo->GetAddOptEnd();
pCMuunInfo->GetConditionType();
pCMuunInfo->GetConditionVal1();
pCMuunInfo->GetConditionVal2();
this->AddMuunItmePeriodData(lpObj, iMuunItemNum, dwSerial, 0, pCMuunInfo);
}
bool CMuunSystem::SetUserMuunEffect(OBJECTSTRUCT *lpObj, int iMuunItemNum, int iMuunLv, int iEquipPos) {
CMuunInfo *pCMuunInfo = m_MuunInfoMng.GetMuunItemNumToMuunInfo(iMuunItemNum);
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] pCMuunInfo is NULL [%s][%s]", lpObj->AccountID, lpObj->Name);
return FALSE;
}
if (iEquipPos == 0) {
lpObj->m_MuunEffectList[0].nOptType = pCMuunInfo->GetOptType();
lpObj->m_MuunEffectList[0].nOptValue = pCMuunInfo->GetMuunLvVal(iMuunLv);
lpObj->m_MuunEffectList[0].nAddOptType = pCMuunInfo->GetAddOptType();
lpObj->m_MuunEffectList[0].nAddOptValue = pCMuunInfo->GetAddOptVal();
lpObj->m_MuunEffectList[0].nIndex = pCMuunInfo->GetIndex();
lpObj->m_MuunEffectList[0].nMuunItemNum = iMuunItemNum;
lpObj->m_MuunEffectList[0].pCMuunInfo = pCMuunInfo;
lpObj->m_MuunEffectList[0].bSkillUsed = false;
lpObj->m_MuunEffectList[0].nSkillDelayTime = pCMuunInfo->GetDelayTime();
lpObj->m_MuunEffectList[0].nTickTime = pCMuunInfo->GetDelayTime() + GetTickCount();
this->SetAddOptTypeValue(&lpObj->m_MuunEffectList[0]);
} else if (iEquipPos == 1) {
lpObj->m_MuunEffectList[1].nOptType = pCMuunInfo->GetOptType();
lpObj->m_MuunEffectList[1].nOptValue = pCMuunInfo->GetMuunLvVal(iMuunLv) / 2;
lpObj->m_MuunEffectList[1].nAddOptType = pCMuunInfo->GetAddOptType();
lpObj->m_MuunEffectList[1].nAddOptValue = pCMuunInfo->GetAddOptVal();
lpObj->m_MuunEffectList[1].nIndex = pCMuunInfo->GetIndex();
lpObj->m_MuunEffectList[1].nMuunItemNum = iMuunItemNum;
lpObj->m_MuunEffectList[1].pCMuunInfo = pCMuunInfo;
lpObj->m_MuunEffectList[1].bSkillUsed = false;
lpObj->m_MuunEffectList[1].nSkillDelayTime = pCMuunInfo->GetDelayTime();
lpObj->m_MuunEffectList[1].nTickTime = pCMuunInfo->GetDelayTime() + GetTickCount();
this->SetAddOptTypeValue(&lpObj->m_MuunEffectList[1]);
}
return TRUE;
}
void CMuunSystem::SetAddOptTypeValue(_tagMUUN_EFFECT_LIST *pUserMuunEffect) {
if (pUserMuunEffect->nAddOptType == 1) {
pUserMuunEffect->nTotalVal = pUserMuunEffect->nOptValue * pUserMuunEffect->nAddOptValue;
} else if (pUserMuunEffect->nAddOptType == 2) {
pUserMuunEffect->nTotalVal = pUserMuunEffect->nOptValue + pUserMuunEffect->nAddOptValue;
} else if (pUserMuunEffect->nAddOptType == 3) {
pUserMuunEffect->nTotalVal = pUserMuunEffect->nOptValue;
}
}
bool CMuunSystem::RemoveUserMuunEffect(OBJECTSTRUCT *lpObj, int iEquipPos) {
if (iEquipPos >= 2) {
return TRUE;
}
CMuunInfo *pCMuunInfo = lpObj->m_MuunEffectList[iEquipPos].pCMuunInfo;
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] pCMuunInfo is NULL [%s][%s]", lpObj->AccountID, lpObj->Name);
return FALSE;
}
int nOptType = pCMuunInfo->GetOptType();
lpObj->m_MuunEffectList[iEquipPos].Clear();
this->CalCharacterStat(lpObj->m_Index, nOptType);
}
bool
CMuunSystem::GetMuunItemValueOfOptType(OBJECTSTRUCT *lpObj, int iMuunOptIndex, int *EffectValue1, int *EffectValue2) {
if (lpObj->Type != OBJ_USER) {
return false;
}
*EffectValue1 = 0;
for (int i = 0; i < MAX_MUUN_EFFECT_LIST; i++) {
if (lpObj->pMuunInventory[i].IsItem() == FALSE) {
continue;
}
if (iMuunOptIndex != lpObj->m_MuunEffectList[i].nOptType) {
continue;
}
if (lpObj->m_MuunEffectList[i].bOptEnable == FALSE) {
continue;
}
if (lpObj->pMuunInventory[i].m_Durability <= 0.0) {
continue;
}
if (lpObj->pMuunInventory[i].IsMuunItemPeriodExpire()) {
*EffectValue1 += lpObj->m_MuunEffectList[i].nOptValue;
} else {
*EffectValue1 += lpObj->m_MuunEffectList[i].nTotalVal;
}
if (iMuunOptIndex == 51) {
if (lpObj->m_MuunEffectList[i].bSkillUsed == true) {
return false;
}
lpObj->m_MuunEffectList[i].bSkillUsed = true;
PMSG_MUUN_ATTACK_COMMAND pMsg;
pMsg.Slot = i;
pMsg.SkillType = 51;
pMsg.NumberH = HIBYTE(lpObj->m_Index);
pMsg.NumberL = LOBYTE(lpObj->m_Index);
pMsg.TargetNumberH = HIBYTE(lpObj->m_Index);
pMsg.TargetNumberL = LOBYTE(lpObj->m_Index);
PHeadSubSetB((LPBYTE) & pMsg, 0x4E, 0x12, sizeof(pMsg));
IOCP.DataSend(lpObj->m_Index, (LPBYTE) & pMsg, pMsg.h.size);
GSProtocol.MsgSendV2(lpObj, (LPBYTE) & pMsg, pMsg.h.size);
}
return true;
}
return false;
}
void CMuunSystem::GDReqLoadMuunInvenItem(OBJECTSTRUCT *obj) {
SDHP_REQ_DBMUUN_INVEN_LOAD pMsg;
if (!ObjectMaxRange(obj->m_Index)) {
return;
}
if (!gObjIsConnected(obj->m_Index)) {
return;
}
memcpy(pMsg.AccountID, obj->AccountID, MAX_ACCOUNT_LEN + 1);
memcpy(pMsg.Name, obj->Name, MAX_ACCOUNT_LEN + 1);
pMsg.aIndex = obj->m_Index;
pMsg.h.c = 0xC1;
pMsg.h.size = sizeof(pMsg);
pMsg.h.headcode = 0xF1;
wsDataCli.DataSend((char *) &pMsg, pMsg.h.size);
}
void CMuunSystem::DGLoadMuunInvenItem(_tagSDHP_ANS_DBMUUN_INVEN_LOAD *lpMsg) {
int aIndex = lpMsg->aIndex;
char szId[11];
szId[MAX_ACCOUNT_LEN] = 0;
memcpy(szId, gObj[aIndex].AccountID, MAX_ACCOUNT_LEN);
if (ObjectMaxRange(aIndex) == false) {
g_Log.AddC(TColor::Yellow, "[DEBUG MUUN] Wrong aIndex (RECV)");
return;
}
if (gObj[aIndex].m_bMapSvrMoveReq == true) {
g_Log.Add("[DGLoadMuunInvenItem] MapServerMove User.Can't Open Event Inven. return!! [%s], IP [%s] ",
gObj[aIndex].AccountID, gObj[aIndex].m_PlayerData->Ip_addr);
return;
}
if (gObj[aIndex].m_State == 32) {
g_Log.Add("[DGLoadMuunInvenItem] MapServerMove User.Can't Open Event Inven. return!! [%s], IP [%s] ",
gObj[aIndex].AccountID, gObj[aIndex].m_PlayerData->Ip_addr);
return;
}
if (gObj[aIndex].m_bMapSvrMoveQuit == 1) {
g_Log.Add("[DGLoadMuunInvenItem] MapServerMove User.Can't Open Event Inven. return!! [%s], IP [%s] ",
gObj[aIndex].AccountID, gObj[aIndex].m_PlayerData->Ip_addr);
return;
}
if (!gObjIsAccontConnect(aIndex, szId)) {
g_Log.Add("error-L1 : Request to receive Warehouse information doesn't match the user. [%s][%d]", szId, aIndex);
return;
}
gObj[aIndex].bMuunInventoryLoad = true;
LPOBJ lpObj = &gObj[aIndex];
int itype;
int _type;
BYTE OptionData;
CItem item;
int nMuunInvenItemCount = 0;
for (int n = 0; n < MUUN_INVENTORY_SIZE; n++) {
itype = lpMsg->dbItems[MAX_DBITEM_INFO * n];
itype |= (lpMsg->dbItems[MAX_DBITEM_INFO * n + 9] & 0xF0) << 5;
itype |= (lpMsg->dbItems[MAX_DBITEM_INFO * n + 7] & 0x80) << 1;
_type = itype;
lpObj->pMuunInventory[n].Clear();
if (lpMsg->dbItems[MAX_DBITEM_INFO * n] == (BYTE) - 1 &&
(lpMsg->dbItems[MAX_DBITEM_INFO * n + 9] & 0xF0) == 0xF0 &&
lpMsg->dbItems[MAX_DBITEM_INFO * n + 7] & 0x80) {
itype = -1;
}
if (IsItem(_type) == FALSE) {
itype = -1;
}
if (itype != -1) {
item.m_Level = DBI_GET_LEVEL(lpMsg->dbItems[MAX_DBITEM_INFO * n + 1]);
OptionData = lpMsg->dbItems[n * MAX_DBITEM_INFO + 1];
item.m_Option1 = DBI_GET_SKILL(OptionData);
item.m_Option2 = DBI_GET_LUCK(OptionData);
item.m_Option3 = DBI_GET_OPTION(OptionData);
if (_type == ITEMGET(13, 3)) {
item.m_Option3 |= (lpMsg->dbItems[MAX_DBITEM_INFO * n + DBI_NOPTION_DATA] & 0x40) >> 4;
}
item.m_Durability = lpMsg->dbItems[MAX_DBITEM_INFO * n + DBI_DUR];
item.m_JewelOfHarmonyOption = lpMsg->dbItems[MAX_DBITEM_INFO * n + DBI_JOH_DATA];
item.m_ItemOptionEx = DBI_GET_380OPTION(lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_OPTION380_DATA]);
if (item.m_ItemOptionEx != 0) {
item.m_Type = itype;
if (!g_kItemSystemFor380.Is380Item(&item)) {
item.m_ItemOptionEx = 0;
g_Log.Add("[380Item][%s][%s] Invalid 380 Item Option in Muun Inventory pos[%d]", lpObj->AccountID,
lpObj->Name, n);
}
}
BYTE SocketOption[5];
BYTE SocketOptionIndex = 0xFF;
memset(&SocketOption, 0xFF, 5);
if (g_SocketOptionSystem.IsEnableSocketItem(itype) == 1) {
SocketOptionIndex = lpMsg->dbItems[MAX_DBITEM_INFO * n + DBI_JOH_DATA];
for (int iSocketSlotIndex = 0; iSocketSlotIndex < 5; iSocketSlotIndex++) {
SocketOption[iSocketSlotIndex] = lpMsg->dbItems[((n * MAX_DBITEM_INFO) + DBI_SOCKET_1) +
iSocketSlotIndex];
}
} else if (g_PentagramSystem.IsPentagramItem(itype) == TRUE ||
g_PentagramSystem.IsPentagramJewel(itype) == TRUE) {
SocketOptionIndex = lpMsg->dbItems[MAX_DBITEM_INFO * n + DBI_JOH_DATA];
for (int iSocketSlotIndex = 0; iSocketSlotIndex < 5; iSocketSlotIndex++) {
SocketOption[iSocketSlotIndex] = lpMsg->dbItems[((n * MAX_DBITEM_INFO) + DBI_SOCKET_1) +
iSocketSlotIndex];
}
} else if (this->IsMuunItem(itype) == TRUE) {
SocketOptionIndex = lpMsg->dbItems[MAX_DBITEM_INFO * n + DBI_JOH_DATA];
for (int iSocketSlotIndex = 0; iSocketSlotIndex < 5; iSocketSlotIndex++) {
SocketOption[iSocketSlotIndex] = lpMsg->dbItems[((n * MAX_DBITEM_INFO) + DBI_SOCKET_1) +
iSocketSlotIndex];
}
} else if (this->IsStoneofEvolution(itype) == TRUE) {
SocketOptionIndex = 0;
for (int iSocketSlotIndex = 0; iSocketSlotIndex < 5; iSocketSlotIndex++) {
SocketOption[iSocketSlotIndex] = lpMsg->dbItems[((n * MAX_DBITEM_INFO) + DBI_SOCKET_1) +
iSocketSlotIndex];
}
} else {
SocketOptionIndex = 0;
for (int iSocketSlotIndex = 0; iSocketSlotIndex < 5; ++iSocketSlotIndex) {
SocketOption[iSocketSlotIndex] = lpMsg->dbItems[((n * MAX_DBITEM_INFO) + DBI_SOCKET_1) +
iSocketSlotIndex];
if (SocketOption[iSocketSlotIndex] == 0) {
SocketOption[iSocketSlotIndex] = 0xFF;
}
}
}
item.m_PeriodItemOption = (lpMsg->dbItems[MAX_DBITEM_INFO * n + 9] & 6) >> 1;
item.Convert(itype, item.m_Option1, item.m_Option2, item.m_Option3,
DBI_GET_NOPTION(lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_NOPTION_DATA]),
lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SOPTION_DATA], item.m_ItemOptionEx, SocketOption,
SocketOptionIndex, item.m_PeriodItemOption, 3);
lpObj->pMuunInventory[n].m_Option1 = item.m_Option1;
lpObj->pMuunInventory[n].m_Option2 = item.m_Option2;
lpObj->pMuunInventory[n].m_Option3 = item.m_Option3;
lpObj->pMuunInventory[n].m_JewelOfHarmonyOption = item.m_JewelOfHarmonyOption;
lpObj->pMuunInventory[n].m_ItemOptionEx = item.m_ItemOptionEx;
DWORD hidword = MAKE_NUMBERDW(MAKE_NUMBERW(lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL1],
lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL2]),
MAKE_NUMBERW(lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL3],
lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL4]));
DWORD lodword = MAKE_NUMBERDW(MAKE_NUMBERW(lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL5],
lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL6]),
MAKE_NUMBERW(lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL7],
lpMsg->dbItems[n * MAX_DBITEM_INFO + DBI_SERIAL8]));
item.m_Number = MAKEQWORD(hidword, lodword);
if (this->IsMuunItem(&item) == TRUE) {
if (item.IsMuunItemPeriodExpire() == FALSE) {
CMuunInfo *pCMuunInfo = this->m_MuunInfoMng.GetMuunItemNumToMuunInfo(itype);
if (pCMuunInfo == NULL) {
g_Log.Add("[MuunSystem][Error] [%s][%s] DGLoadMuunInvenItem() pCMuunInfo is NULL %d",
lpObj->AccountID, lpObj->Name, __LINE__);
} else {
if (this->CheckAddOptionExpireDate(pCMuunInfo->GetAddOptStart(), pCMuunInfo->GetAddOptEnd()) ==
TRUE) {
item.SetMuunItemPeriodExpire();
} else {
this->SetMuunItemAddPeriodData(lpObj, itype, item.m_Number);
}
}
} else {
CMuunInfo *pCMuunInfo = this->m_MuunInfoMng.GetMuunItemNumToMuunInfo(itype);
if (pCMuunInfo == NULL) {
g_Log.Add("[MuunSystem][Error] [%s][%s] DGLoadMuunInvenItem() pCMuunInfo is NULL %d",
lpObj->AccountID, lpObj->Name, __LINE__);
} else {
if (this->CheckAddOptionExpireDate(pCMuunInfo->GetAddOptStart(), pCMuunInfo->GetAddOptEnd()) ==
FALSE) {
item.SetMuunItemPeriodReset();
this->SetMuunItemAddPeriodData(lpObj, itype, item.m_Number);
g_Log.Add(
"[MuunSystem][MuunItemPeriodReset] [%s][%s] MuunItemPeriodReset() Type:[%d] serial:[%I64d]",
lpObj->AccountID, lpObj->Name, itype, item.m_Number);
}
}
}
}
gObjMuunInventoryInsertItemPos(lpObj->m_Index, item, n);
if (n < 2) {
this->MuunItemEquipment(lpObj->m_Index, n, -1);
if (!n) {
GSProtocol.GCMuunEquipmentChange(lpObj->m_Index, 0);
}
}
nMuunInvenItemCount++;
}
}
for (int i = 0; i < MUUN_INVENTORY_SIZE; i++) {
if (lpObj->pMuunInventory[i].IsItem() == TRUE) {
if (this->IsStoneofEvolution(lpObj->pMuunInventory[i].m_Type) == TRUE) {
WORD wPetItemNumber =
(lpObj->pMuunInventory[i].m_SocketOption[0] << 8) | lpObj->pMuunInventory[i].m_SocketOption[1];
LPITEM_ATTRIBUTE lpItemAttribute = GetItemAttr(wPetItemNumber);
if (lpItemAttribute != NULL) {
BYTE NewOption[MAX_EXOPTION_SIZE];
ItemIsBufExOption(NewOption, &lpObj->pMuunInventory[i]);
g_Log.Add(
"[%s][%s]MI[%d,%s(%s),%d,%d,%d,%d] Rank:[%d] Expire:[%d] serial:[%I64d] dur:[%d] Ex:[%d,%d,%d,%d,%d,%d,%d] Set[%d]",
lpObj->AccountID, lpObj->Name, i, lpObj->pMuunInventory[i].GetName(), lpItemAttribute->Name,
lpObj->pMuunInventory[i].m_Level, lpObj->pMuunInventory[i].m_Option1,
lpObj->pMuunInventory[i].m_Option2, lpObj->pMuunInventory[i].m_Option3,
lpObj->pMuunInventory[i].GetMuunItemRank(),
lpObj->pMuunInventory[i].IsMuunItemPeriodExpire(),
lpObj->pMuunInventory[i].m_Number, (int) lpObj->pMuunInventory[i].m_Durability,
NewOption[0], NewOption[1], NewOption[2], NewOption[3], NewOption[4],
NewOption[5], NewOption[6], lpObj->pMuunInventory[i].m_SetOption);
} else {
g_Log.Add("[MuunSystem][Error] [%s][%s] DGLoadMuunInvenItem() pCMuunInfo is NULL %d",
lpObj->AccountID, lpObj->Name, __LINE__);
}
} else {
BYTE NewOption[MAX_EXOPTION_SIZE];
ItemIsBufExOption(NewOption, &lpObj->pMuunInventory[i]);
g_Log.Add(
"[%s][%s]MI[%d,%s,%d,%d,%d,%d] Rank:[%d] Expire:[%d] serial:[%I64d] dur:[%d] Ex:[%d,%d,%d,%d,%d,%d,%d] Set[%d]",
lpObj->AccountID, lpObj->Name, i, lpObj->pMuunInventory[i].GetName(),
lpObj->pMuunInventory[i].m_Level, lpObj->pMuunInventory[i].m_Option1,
lpObj->pMuunInventory[i].m_Option2, lpObj->pMuunInventory[i].m_Option3,
lpObj->pMuunInventory[i].GetMuunItemRank(), lpObj->pMuunInventory[i].IsMuunItemPeriodExpire(),
lpObj->pMuunInventory[i].m_Number, (int) lpObj->pMuunInventory[i].m_Durability, NewOption[0],
NewOption[1], NewOption[2], NewOption[3], NewOption[4],
NewOption[5], NewOption[6], lpObj->pMuunInventory[i].m_SetOption);
}
}
}
g_Log.Add("[MuunInvenItem] [%s][%s] ItemCount[%d] Muun Item Load Complete.", lpObj->AccountID, lpObj->Name,
nMuunInvenItemCount);
GCMuunInventoryItemListSend(aIndex);
lpObj->dwCheckMuunItemTime = GetTickCount();
}
void CMuunSystem::GDReqSaveMuunInvenItem(LPOBJ lpObj) {
if (lpObj->bMuunInventoryLoad == false) {
return;
}
if (!ObjectMaxRange(lpObj->m_Index)) {
return;
}
if (!gObjIsConnected(lpObj->m_Index)) {
return;
}
for (int n = 0; n < MUUN_INVENTORY_SIZE; n++) {
if (lpObj->pMuunInventory[n].IsItem() == FALSE) {
continue;
}
if (this->IsStoneofEvolution(lpObj->pMuunInventory[n].m_Type) == TRUE) {
WORD wPetItemNumber =
(lpObj->pMuunInventory[n].m_SocketOption[0] << 8) | lpObj->pMuunInventory[n].m_SocketOption[1];
LPITEM_ATTRIBUTE pItemAttribute = GetItemAttr(wPetItemNumber);
if (!pItemAttribute) {
g_Log.Add("[MuunSystem][Error][%s][%s] GDReqSaveMuunInvenItem() pItemAttribute is NULL",
lpObj->AccountID, lpObj->Name);
} else {
BYTE NewOption[MAX_EXOPTION_SIZE];
ItemIsBufExOption(NewOption, &lpObj->pMuunInventory[n]);
g_Log.Add(
"[%s][%s]MI[%d,%s(%s),%d,%d,%d,%d] Rank:[%d] Expire:[%d] serial:[%I64d] dur:[%d] Ex:[%d,%d,%d,%d,%d,%d,%d] Set[%d] 380:[%d] HO:[%d,%d] SC[%d,%d,%d,%d,%d] BonusOption[%d]",
lpObj->AccountID, lpObj->Name, n, lpObj->pMuunInventory[n].GetName(), pItemAttribute->Name,
lpObj->pMuunInventory[n].m_Level, lpObj->pMuunInventory[n].m_Option1,
lpObj->pMuunInventory[n].m_Option2, lpObj->pMuunInventory[n].m_Option3,
lpObj->pMuunInventory[n].GetMuunItemRank(), lpObj->pMuunInventory[n].IsMuunItemPeriodExpire(),
lpObj->pMuunInventory[n].m_Number,
(int) lpObj->pMuunInventory[n].m_Durability, NewOption[0], NewOption[1], NewOption[2],
NewOption[3], NewOption[4], NewOption[5], NewOption[6],
lpObj->pMuunInventory[n].m_SetOption, lpObj->pMuunInventory[n].m_ItemOptionEx >> 7,
g_kJewelOfHarmonySystem.GetItemStrengthenOption(&lpObj->pMuunInventory[n]),
g_kJewelOfHarmonySystem.GetItemOptionLevel(&lpObj->pMuunInventory[n]),
lpObj->pMuunInventory[n].m_SocketOption[0], lpObj->pMuunInventory[n].m_SocketOption[1],
lpObj->pMuunInventory[n].m_SocketOption[2], lpObj->pMuunInventory[n].m_SocketOption[3],
lpObj->pMuunInventory[n].m_SocketOption[4],
lpObj->pMuunInventory[n].m_BonusSocketOption);
}
} else {
BYTE NewOption[MAX_EXOPTION_SIZE];
ItemIsBufExOption(NewOption, &lpObj->pMuunInventory[n]);
g_Log.Add(
"[%s][%s]MI[%d,%s,%d,%d,%d,%d] Rank:[%d] Expire:[%d] serial:[%I64d] dur:[%d] Ex:[%d,%d,%d,%d,%d,%d,%d] Set[%d] 380:[%d] HO:[%d,%d] SC[%d,%d,%d,%d,%d] BonusOption[%d]",
lpObj->AccountID, lpObj->Name, n, lpObj->pMuunInventory[n].GetName(),
lpObj->pMuunInventory[n].m_Level, lpObj->pMuunInventory[n].m_Option1,
lpObj->pMuunInventory[n].m_Option2, lpObj->pMuunInventory[n].m_Option3,
lpObj->pMuunInventory[n].GetMuunItemRank(), lpObj->pMuunInventory[n].IsMuunItemPeriodExpire(),
lpObj->pMuunInventory[n].m_Number,
(int) lpObj->pMuunInventory[n].m_Durability, NewOption[0], NewOption[1], NewOption[2], NewOption[3],
NewOption[4], NewOption[5], NewOption[6],
lpObj->pMuunInventory[n].m_SetOption, lpObj->pMuunInventory[n].m_ItemOptionEx >> 7,
g_kJewelOfHarmonySystem.GetItemStrengthenOption(&lpObj->pMuunInventory[n]),
g_kJewelOfHarmonySystem.GetItemOptionLevel(&lpObj->pMuunInventory[n]),
lpObj->pMuunInventory[n].m_SocketOption[0], lpObj->pMuunInventory[n].m_SocketOption[1],
lpObj->pMuunInventory[n].m_SocketOption[2], lpObj->pMuunInventory[n].m_SocketOption[3],
lpObj->pMuunInventory[n].m_SocketOption[4],
lpObj->pMuunInventory[n].m_BonusSocketOption);
}
}
g_Log.Add("[MuunInvenItem] [%s][%s] Muun Item Save Complete.", lpObj->AccountID, lpObj->Name);
_tagSDHP_REQ_DBMUUN_INVEN_SAVE pMsg;
memcpy(pMsg.AccountID, lpObj->AccountID, MAX_ACCOUNT_LEN + 1);
memcpy(pMsg.Name, lpObj->Name, MAX_ACCOUNT_LEN + 1);
pMsg.h.c = 0xC2;
pMsg.h.sizeH = SET_NUMBERH(sizeof(pMsg));
pMsg.h.sizeL = SET_NUMBERL(sizeof(pMsg));
pMsg.h.headcode = 0xF2;
ItemByteConvert32((LPBYTE) pMsg.dbInventory, lpObj->pMuunInventory, MUUN_INVENTORY_SIZE);
wsDataCli.DataSend((char *) &pMsg, sizeof(pMsg));
}
void CMuunSystem::GCSendConditionStatus(int aIndex, int iPos, int iStatus) {
PMSG_MUUNITEM_CONDITION_STATUS pMsg;
pMsg.btStatus = iStatus;
pMsg.btIPos = iPos;
PHeadSubSetB((LPBYTE) & pMsg, 0x4E, 0x07, sizeof(pMsg));
this->MsgIsMuunItemActive(&gObj[aIndex], iPos);
IOCP.DataSend(aIndex, (LPBYTE) & pMsg, pMsg.h.size);
}
bool CMuunSystem::IsMuunItem(CItem *pCitem) {
if (!pCitem) {
return false;
}
LPITEM_ATTRIBUTE pItemAttribute = GetItemAttr(pCitem->m_Type);
if (!pItemAttribute) {
return false;
}
return pItemAttribute->ItemKindA == 12 && (pItemAttribute->ItemKindB >= 63 && pItemAttribute->ItemKindB <= 66);
}
bool CMuunSystem::IsMuunItem(int iItemNum) {
LPITEM_ATTRIBUTE pItemAttribute = GetItemAttr(iItemNum);
if (!pItemAttribute) {
return false;
}
return pItemAttribute->ItemKindA == 12 && (pItemAttribute->ItemKindB >= 63 && pItemAttribute->ItemKindB <= 66);
}
bool CMuunSystem::IsStoneofEvolution(CItem *pCitem) {
if (!pCitem) {
return false;
}
LPITEM_ATTRIBUTE pItemAttribute = GetItemAttr(pCitem->m_Type);
if (!pItemAttribute) {
return false;
}
return pItemAttribute->ItemKindA == 12 && pItemAttribute->ItemKindB == 0;
}
bool CMuunSystem::IsStoneofEvolution(int iItemNum) {
LPITEM_ATTRIBUTE pItemAttribute = GetItemAttr(iItemNum);
if (!pItemAttribute) {
return false;
}
return pItemAttribute->ItemKindA == 12 && pItemAttribute->ItemKindB == 0;
}
int CMuunSystem::GetEvolutionMuunItemIndex(int iItemNum) {
CMuunInfo *pCMuunInfo = this->m_MuunInfoMng.GetMuunItemNumToMuunInfo(iItemNum);
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error]GetEvolutionMuunItemIndex() pItemAttribute is NULL %d", __LINE__);
return 0;
}
return pCMuunInfo->GetEvolutionMuunNum();
}
int CMuunSystem::GetBeforeEvolutionMuunItemIndex(int iItemNum) {
return this->m_MuunInfoMng.GetBeforeEvolutionMuunItemIndex(iItemNum);
}
int CMuunSystem::GetMuunRankOfMuunInfo(int iItemNum) {
CMuunInfo *pCMuunInfo = this->m_MuunInfoMng.GetMuunItemNumToMuunInfo(iItemNum);
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] GetMuunRankOfMuunInfo() pCMuunInfo is NULL %d", __LINE__);
return 0;
}
return pCMuunInfo->GetMuunRank();
}
void CMuunSystem::CGMuunInventoryUseItemRecv(PMSG_USEITEM_MUUN_INVEN *lpMsg, int aIndex) {
int iItemUseType = lpMsg->btItemUseType;
if (gObj[aIndex].m_IfState.use == 1) {
g_Log.Add("[%s][%s]_If return %d", gObj[aIndex].AccountID, gObj[aIndex].Name, __LINE__);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
if (gObj[aIndex].CloseType != -1) {
g_Log.Add("[%s][%s] CGMuunInventoryUseItemRecv()_CloseType return %d", gObj[aIndex].AccountID,
gObj[aIndex].Name, __LINE__);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
if (!::gObjFixMuunInventoryPointer(aIndex)) {
g_Log.Add("[Fix Inv.Ptr] False Location - %d", __LINE__);
}
if (gObj[aIndex].pTransaction == 1) {
g_Log.Add("[%s][%s] CGUseItemRecv() Failed : Transaction == 1, IF_TYPE : %d", gObj[aIndex].AccountID,
gObj[aIndex].Name, gObj[aIndex].m_IfState.type);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
if (g_NewPVP.IsObserver(gObj[aIndex])) {
GSProtocol.GCServerMsgStringSend(Lang.GetText(0, 562), aIndex, 1);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
if (lpMsg->inventoryPos == lpMsg->invenrotyTarget) {
g_Log.Add("error-L1 : [%s][%s] CGMuunInventoryUseItemRecv()_Pos return %d", gObj[aIndex].AccountID,
gObj[aIndex].Name, __LINE__);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
switch (iItemUseType) {
case 1:
if (this->MuunItemLevelUp(&gObj[aIndex], lpMsg->inventoryPos, lpMsg->invenrotyTarget) == FALSE) {
g_Log.Add("[MuunSystem][LevelUp] [%s][%s] [Fail]", gObj[aIndex].AccountID, gObj[aIndex].Name);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
this->ClearPeriodMuunItemData(&gObj[aIndex], gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].m_Type,
gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].m_Number);
gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].Clear();
GSProtocol.GCMuunInventoryItemDeleteSend(aIndex, lpMsg->inventoryPos, 1);
GSProtocol.GCMuunInventoryItemOneSend(aIndex, lpMsg->invenrotyTarget);
break;
case 2:
if (this->MuunItemEvolution(&gObj[aIndex], lpMsg->inventoryPos, lpMsg->invenrotyTarget) == FALSE) {
g_Log.Add("[MuunSystem] [%s][%s]Item Use Muun Item Evolution Fail", gObj[aIndex].AccountID,
gObj[aIndex].Name);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].Clear();
GSProtocol.GCMuunInventoryItemDeleteSend(aIndex, lpMsg->inventoryPos, 1);
break;
case 3:
if (this->MuunItemLifeGem(&gObj[aIndex], lpMsg->inventoryPos, lpMsg->invenrotyTarget) == FALSE) {
g_Log.Add("[MuunSystem] [%s][%s]Item Use Muun Item LifeGem Fail", gObj[aIndex].AccountID,
gObj[aIndex].Name);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
gObjInventoryItemSet(aIndex, lpMsg->inventoryPos, -1);
gObj[aIndex].pInventory[lpMsg->inventoryPos].Clear();
GSProtocol.GCInventoryItemDeleteSend(aIndex, lpMsg->inventoryPos, 1);
GSProtocol.GCMuunItemDurSend(aIndex, lpMsg->invenrotyTarget, -1);
break;
case 4:
if (this->MuunItemEnergyGenerator(&gObj[aIndex], lpMsg->inventoryPos, lpMsg->invenrotyTarget) == FALSE) {
g_Log.Add("[MuunSystem] [%s][%s]Item Use Muun Item Energy Generator Fail", gObj[aIndex].AccountID,
gObj[aIndex].Name);
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 1);
return;
}
this->ClearPeriodMuunItemData(&gObj[aIndex], gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].m_Type,
gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].m_Number);
gObj[aIndex].pMuunInventory[lpMsg->inventoryPos].Clear();
GSProtocol.GCMuunInventoryItemDeleteSend(aIndex, lpMsg->inventoryPos, 1);
GSProtocol.GCMuunInventoryItemOneSend(aIndex, lpMsg->invenrotyTarget);
break;
}
this->GCMuunInventoryUseItemResult(aIndex, iItemUseType, 0);
}
bool CMuunSystem::MuunItemEvolution(OBJECTSTRUCT *lpObj, int source, int target) {
if (source < 2 || source > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (target < 2 || target > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (lpObj->pMuunInventory[source].IsItem() == FALSE) {
return false;
}
if (lpObj->pMuunInventory[target].IsItem() == FALSE) {
return false;
}
if (this->IsStoneofEvolution(lpObj->pMuunInventory[source].m_Type) == FALSE) {
return false;
}
if (this->IsMuunItem(lpObj->pMuunInventory[target].m_Type) == FALSE) {
return false;
}
if (lpObj->pMuunInventory[target].m_Level == 0) {
return false;
}
WORD nEvoMuunItemNum =
(lpObj->pMuunInventory[source].m_SocketOption[0] << 8) | lpObj->pMuunInventory[source].m_SocketOption[1];
if (nEvoMuunItemNum != lpObj->pMuunInventory[target].m_Type) {
return false;
}
if (lpObj->pMuunInventory[target].GetMuunItemRank() + 1 != lpObj->pMuunInventory[target].m_Level) {
return false;
}
if (lpObj->pMuunInventory[target].GetMuunItemRank() + 1 < lpObj->pMuunInventory[target].m_Level) {
g_Log.Add("[MuunSystem][Error][%s][%s] Over Level(%d) %d", lpObj->AccountID, lpObj->Name,
lpObj->pMuunInventory[target].m_Level, __LINE__);
return false;
}
WORD nEvolutionMuunNum = this->GetEvolutionMuunItemIndex(lpObj->pMuunInventory[target].m_Type);
if (nEvolutionMuunNum == 0) {
g_Log.Add("[MuunSystem][Error][%s][%s] Not Evolution MuunItem Index - target Item Index(%d) %d",
lpObj->AccountID, lpObj->Name, lpObj->pMuunInventory[target].m_Type, __LINE__);
return false;
}
LPITEM_ATTRIBUTE pSItemAttribute = GetItemAttr(lpObj->pMuunInventory[source].m_Type);
LPITEM_ATTRIBUTE pTItemAttribute = GetItemAttr(lpObj->pMuunInventory[target].m_Type);
if (pTItemAttribute && pSItemAttribute) {
UINT64 serial = lpObj->pMuunInventory[target].m_Number;
WORD Level = lpObj->pMuunInventory[target].m_Level;
int iMuunRank = lpObj->pMuunInventory[target].GetMuunItemRank();
g_Log.Add(
"[MuunSystem][Evolution] [%s][%s] [Success] Source: [%s] Pos[%d] Serial[%I64d] - Target: [%s] Pos[%d] Rank[%d] Level[%d] Serial[%I64d]",
lpObj->AccountID, lpObj->Name, pSItemAttribute->Name, source, lpObj->pMuunInventory[source].m_Number,
pTItemAttribute->Name, target, iMuunRank, Level, serial);
}
float fDur = lpObj->pMuunInventory[target].m_Durability;
this->ClearPeriodMuunItemData(lpObj, lpObj->pMuunInventory[target].m_Type, lpObj->pMuunInventory[target].m_Number);
GSProtocol.GCMuunInventoryItemDeleteSend(lpObj->m_Index, target, 1);
lpObj->pMuunInventory[target].Clear();
BYTE SocketOption[5];
memset(SocketOption, -1, sizeof(SocketOption));
ItemSerialCreateSend(lpObj->m_Index, 0xE0, 0, 0, nEvolutionMuunNum, 0, fDur, 0, 0, 0, lpObj->m_Index, 0, 0, 0,
SocketOption, 0);
return true;
}
bool CMuunSystem::MuunItemLevelUp(OBJECTSTRUCT *lpObj, int source, int target) {
if (source < 2 || source > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (target < 2 || target > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (lpObj->pMuunInventory[source].IsItem() == FALSE) {
return false;
}
if (lpObj->pMuunInventory[target].IsItem() == FALSE) {
return false;
}
if (this->IsMuunItem(lpObj->pMuunInventory[target].m_Type) == FALSE) {
return false;
}
if (this->IsMuunItem(lpObj->pMuunInventory[source].m_Type) == FALSE) {
return false;
}
if (lpObj->pMuunInventory[source].m_Level == 0 || lpObj->pMuunInventory[target].m_Level == 0) {
return false;
}
if (lpObj->pMuunInventory[source].m_Type != lpObj->pMuunInventory[target].m_Type) {
return false;
}
if (lpObj->pMuunInventory[source].m_Level != 1) {
return false;
}
if (lpObj->pMuunInventory[target].GetMuunItemRank() + 1 == lpObj->pMuunInventory[target].m_Level) {
return false;
}
if (lpObj->pMuunInventory[target].m_Level >= 5) {
return false;
}
if (lpObj->pMuunInventory[target].GetMuunItemRank() + 1 < lpObj->pMuunInventory[target].m_Level) {
g_Log.Add("[MuunSystem][Error][%s][%s] Over Level(%d) %d", lpObj->AccountID, lpObj->Name,
lpObj->pMuunInventory[target].m_Level, __LINE__);
return false;
}
int nBeforeLv = lpObj->pMuunInventory[target].m_Level;
lpObj->pMuunInventory[target].m_Level++;
LPITEM_ATTRIBUTE pSItemAttribute = GetItemAttr(lpObj->pMuunInventory[source].m_Type);
LPITEM_ATTRIBUTE pTItemAttribute = GetItemAttr(lpObj->pMuunInventory[target].m_Type);
if (pTItemAttribute && pSItemAttribute) {
g_Log.Add(
"[MuunSystem][LevelUp] [%s][%s] [Success] Source: [%s] Pos[%d] Rank[%d] Level[%d] Serial[%I64d] - Target: [%s] Pos[%d] Rank[%d] Level[%d]/[%d] Serial[%I64d]",
lpObj->AccountID, lpObj->Name, pSItemAttribute->Name, source,
lpObj->pMuunInventory[source].GetMuunItemRank(), lpObj->pMuunInventory[source].m_Level,
lpObj->pMuunInventory[source].m_Number,
pTItemAttribute->Name, target, lpObj->pMuunInventory[target].GetMuunItemRank(), nBeforeLv,
lpObj->pMuunInventory[target].m_Level, lpObj->pMuunInventory[target].m_Number);
}
return true;
}
bool CMuunSystem::MuunItemLifeGem(OBJECTSTRUCT *lpObj, int source, int target) {
if (source < INVETORY_WEAR_SIZE || source > MAIN_INVENTORY_SIZE - 1) {
return false;
}
if (target < 2 || target > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (lpObj->pInventory[source].IsItem() == FALSE) {
return false;
}
if (lpObj->pMuunInventory[target].IsItem() == FALSE) {
return false;
}
if (this->IsMuunItem(lpObj->pMuunInventory[target].m_Type) == FALSE) {
return false;
}
if (lpObj->pInventory[source].m_Type != ITEMGET(14, 16)) {
return false;
}
if (lpObj->pMuunInventory[target].m_Durability >= 255.0) {
return false;
}
int nBeforeDur = lpObj->pMuunInventory[target].m_Durability;
lpObj->pMuunInventory[target].m_Durability = 255.0;
LPITEM_ATTRIBUTE pItemAttribute = GetItemAttr(lpObj->pInventory[source].m_Type);
if (pItemAttribute) {
g_Log.Add("[MuunSystem] [%s][%s] Item Use Muun Item LifeGem Success target[%d] [%s] Dur:[%d]/[%d] Serial:%I64d",
lpObj->AccountID, lpObj->Name, target, pItemAttribute->Name, nBeforeDur,
(int) lpObj->pMuunInventory[target].m_Durability, lpObj->pMuunInventory[target].m_Number);
}
return true;
}
bool CMuunSystem::MuunItemEnergyGenerator(LPOBJ lpObj, int source, int target) {
if (source < 2 || source > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (target < 2 || target > MUUN_INVENTORY_SIZE - 1) {
return false;
}
if (lpObj->pMuunInventory[source].IsItem() == FALSE) {
return false;
}
if (lpObj->pMuunInventory[target].IsItem() == FALSE) {
return false;
}
int nEnergy = 0;
int nRankEnergy = 0;
int nLvEnergy = 0;
if (this->IsStoneofEvolution(lpObj->pMuunInventory[source].m_Type) == FALSE &&
this->IsMuunItem(lpObj->pMuunInventory[source].m_Type) == FALSE &&
lpObj->pMuunInventory[source].m_Type != ITEMGET(13, 239)) {
return false;
}
if (lpObj->pMuunInventory[target].m_Type != ITEMGET(13, 239)) {
return false;
}
int nMuunRank = lpObj->pMuunInventory[source].GetMuunItemRank();
int nMuunLv = lpObj->pMuunInventory[source].m_Level;
if (this->IsMuunItem(lpObj->pMuunInventory[source].m_Type) == TRUE) {
for (int i = 0; i < 8; i++) {
if (nMuunRank == this->m_stEnergyGeneratorPoint[i].iRank) {
nRankEnergy = this->m_stEnergyGeneratorPoint[i].iRankPt;
}
if (nMuunLv == this->m_stEnergyGeneratorPoint[i].iMuunLv) {
nLvEnergy = this->m_stEnergyGeneratorPoint[i].iMuunLvPt;
}
}
if (nMuunLv != 0) {
nEnergy = nLvEnergy * nRankEnergy;
} else {
nEnergy = nLvEnergy * (nRankEnergy + nRankEnergy * nRankEnergy);
}
} else if (this->IsStoneofEvolution(lpObj->pMuunInventory[source].m_Type) == TRUE) {
nEnergy = this->m_iStoneOfEvolutionPt;
} else if (lpObj->pMuunInventory[source].m_Type == ITEMGET(13, 239)) {
nEnergy = lpObj->pMuunInventory[source].m_Durability;
}
int nMuunDurability = nEnergy + lpObj->pMuunInventory[target].m_Durability;
if (nMuunDurability < 120) {
LPITEM_ATTRIBUTE pSItemAttribute = GetItemAttr(lpObj->pMuunInventory[source].m_Type);
LPITEM_ATTRIBUTE pTItemAttribute = GetItemAttr(lpObj->pMuunInventory[target].m_Type);
if (pTItemAttribute && pSItemAttribute) {
g_Log.Add(
"[MuunSystem][EnergyGenerator] [%s][%s] [Mix Success] Source: [%s] Pos[%d] Rank[%d] Level[%d] Serial[%I64d] - Target: [%s] Pos[%d] Serial[%I64d] Dur[%d/%d/%d]",
lpObj->AccountID, lpObj->Name, pSItemAttribute->Name, source,
lpObj->pMuunInventory[source].m_Durability, lpObj->pMuunInventory[source].m_Level,
lpObj->pMuunInventory[source].m_Number,
pTItemAttribute->Name, target, lpObj->pInventory[target].m_Number,
lpObj->pMuunInventory[target].m_Durability, nEnergy, nMuunDurability);
}
lpObj->pMuunInventory[target].m_Durability = nMuunDurability;
GSProtocol.GCMuunItemDurSend(lpObj->m_Index, target, nMuunDurability);
} else {
LPITEM_ATTRIBUTE pSItemAttribute = GetItemAttr(lpObj->pMuunInventory[source].m_Type);
LPITEM_ATTRIBUTE pTItemAttribute = GetItemAttr(lpObj->pMuunInventory[target].m_Type);
if (pTItemAttribute && pSItemAttribute) {
g_Log.Add(
"[MuunSystem][EnergyGenerator] [%s][%s] [Create Success] Source: [%s] Pos[%d] Rank[%d] Level[%d] Serial[%I64d] - Target: [%s] Pos[%d] Serial[%I64d] Dur[%d/%d/%d]",
lpObj->AccountID, lpObj->Name, pSItemAttribute->Name, source,
lpObj->pMuunInventory[source].m_Durability, lpObj->pMuunInventory[source].m_Level,
lpObj->pMuunInventory[source].m_Number,
pTItemAttribute->Name, target, lpObj->pInventory[target].m_Number,
lpObj->pMuunInventory[target].m_Durability, nEnergy, nMuunDurability);
}
int iType = ITEMGET(13, 240);
int iLevel = 0;
float fDur = 255.0;
BYTE SocketOption[5];
memset(SocketOption, -1, sizeof(SocketOption));
ItemSerialCreateSend(lpObj->m_Index, 0xE0, 0, 0, iType, iLevel, fDur, 0, 0, 0, lpObj->m_Index, 0, 0, 0,
SocketOption, 0);
lpObj->pMuunInventory[target].Clear();
GSProtocol.GCMuunInventoryItemDeleteSend(lpObj->m_Index, target, 1);
}
return true;
}
void CMuunSystem::GCMuunInventoryUseItemResult(int aIndex, int iUseType, int iResult) {
PMSG_USEITEM_MUUN_INVEN_RESULT pResult;
pResult.btItemUseType = iUseType;
pResult.btResult = iResult;
PHeadSubSetB((LPBYTE) & pResult, 0x4E, 0x08, sizeof(pResult));
IOCP.DataSend(aIndex, (LPBYTE) & pResult, pResult.h.size);
}
int CMuunSystem::AddMuunItemPeriodInfo(OBJECTSTRUCT *lpObj) {
for (int i = 0; i < g_ConfigRead.server.GetObjectMaxUser(); i++) {
if (this->m_MuunItemPeriodData[i].bIsUsed == false) {
this->m_MuunItemPeriodData[i].Clear();
this->m_MuunItemPeriodData[i].bIsUsed = true;
this->m_MuunItemPeriodData[i].lpUserObj = lpObj;
this->m_MuunItemPeriodData[i].dwUserGUID = lpObj->DBNumber;
this->m_MuunItemPeriodData[i].wUserIndex = lpObj->m_Index;
this->m_MuunItemPeriodData[i].btUsedDataCount = 0;
memcpy(this->m_MuunItemPeriodData[i].chAccountID, lpObj->Name, MAX_ACCOUNT_LEN + 1);
memcpy(this->m_MuunItemPeriodData[i].chCharacterName, lpObj->AccountID, MAX_ACCOUNT_LEN + 1);
lpObj->m_iMuunItmePeriodDataIndex = i;
return i;
}
}
return -1;
}
bool CMuunSystem::RemoveMuunItemPeriodInfo(OBJECTSTRUCT *lpObj) {
if (this->IsCorrectUser(lpObj) == false) {
return false;
}
int iPeriodItemSlotIndex = lpObj->m_iMuunItmePeriodDataIndex;
if (iPeriodItemSlotIndex < 0 || iPeriodItemSlotIndex >= g_ConfigRead.server.GetObjectMaxUser()) {
return false;
}
if (this->m_MuunItemPeriodData[iPeriodItemSlotIndex].bIsUsed == false) {
return false;
}
this->m_MuunItemPeriodData[iPeriodItemSlotIndex].Clear();
return true;
}
bool CMuunSystem::IsCorrectUser(OBJECTSTRUCT *lpObj) {
int iPeriodItemSlotIndex = lpObj->m_iMuunItmePeriodDataIndex;
if (iPeriodItemSlotIndex < 0 || iPeriodItemSlotIndex >= g_ConfigRead.server.GetObjectMax()) {
return false;
}
if (this->m_MuunItemPeriodData[iPeriodItemSlotIndex].bIsUsed == FALSE) {
return false;
}
if (this->m_MuunItemPeriodData[iPeriodItemSlotIndex].dwUserGUID != lpObj->DBNumber) {
return false;
}
return true;
}
int CMuunSystem::AddMuunItmePeriodData(OBJECTSTRUCT *lpObj, WORD wItemCode, UINT64 dwSerial, int iDuration,
CMuunInfo *pCMuunInfo) {
int iMuunItemPeriodDataIndex = lpObj->m_iMuunItmePeriodDataIndex;
if (CMuunSystem::IsCorrectUser(lpObj) == false) {
return -1;
}
for (int i = 0; i < MUUN_INVENTORY_SIZE; i++) {
if (!this->m_MuunItemPeriodData[iMuunItemPeriodDataIndex].ItemData[i].bIsUsed) {
this->GetExpireDate(iDuration);
this->m_MuunItemPeriodData[iMuunItemPeriodDataIndex].ItemData[i].bIsUsed = TRUE;
this->m_MuunItemPeriodData[iMuunItemPeriodDataIndex].ItemData[i].wItemCode = wItemCode;
this->m_MuunItemPeriodData[iMuunItemPeriodDataIndex].ItemData[i].dwSerial = dwSerial;
this->m_MuunItemPeriodData[iMuunItemPeriodDataIndex].ItemData[i].pCMuunInfo = pCMuunInfo;
return i;
}
}
return -1;
}
void CMuunSystem::CheckMuunItemPeriodData(OBJECTSTRUCT *lpObj) {
if (lpObj == NULL) {
g_Log.Add("[MuunSystem][Error] lpObj is NULL [%d]", __LINE__);
return;
}
this->SkillProc(lpObj);
if (GetTickCount() - lpObj->dwCheckMuunItemTime >= 60000) {
lpObj->dwCheckMuunItemTime = GetTickCount();
int i = lpObj->m_iMuunItmePeriodDataIndex;
if (i < 0 || i >= g_ConfigRead.server.GetObjectMaxUser()) {
return;
}
if (this->m_MuunItemPeriodData[i].bIsUsed == TRUE) {
if (this->m_MuunItemPeriodData[i].lpUserObj != NULL) {
LPOBJ lpUserObj = this->m_MuunItemPeriodData[i].lpUserObj;
if (lpUserObj->Type == OBJ_USER) {
if (lpUserObj->Connected == PLAYER_PLAYING) {
this->CheckEquipMuunItemConditionProc(lpUserObj);
for (int iItemSlotIndex = 0; iItemSlotIndex < MUUN_INVENTORY_SIZE; iItemSlotIndex++) {
if (this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].bIsUsed == TRUE) {
CMuunInfo *pCMuunInfo = this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].pCMuunInfo;
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] pCMuunInfo is NULL [%s][%s] [%d]",
lpUserObj->AccountID, lpUserObj->Name, __LINE__);
return;
}
if (this->CheckAddOptionExpireDate(pCMuunInfo->GetAddOptStart(),
pCMuunInfo->GetAddOptEnd()) == 1) {
this->RemovePeriodMunnItemData(lpUserObj,
this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].wItemCode,
this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].dwSerial);
this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].Clear();
}
}
}
}
}
}
}
}
}
bool CMuunSystem::ClearPeriodMuunItemData(OBJECTSTRUCT *lpObj, WORD wItemCode, UINT64 dwSerial) {
bool result;
signed int iItemSlotIndex;
if (lpObj) {
if (lpObj->Type == OBJ_USER && lpObj->Connected >= PLAYER_LOGGED) {
if (this->IsMuunItem(wItemCode)) {
int i = lpObj->m_iMuunItmePeriodDataIndex;
if (this->m_MuunItemPeriodData[i].bIsUsed == TRUE) {
for (iItemSlotIndex = 0; iItemSlotIndex < MUUN_INVENTORY_SIZE; ++iItemSlotIndex) {
if (this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].bIsUsed == 1
&& this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].wItemCode == wItemCode
&& this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].dwSerial == dwSerial) {
this->m_MuunItemPeriodData[i].ItemData[iItemSlotIndex].Clear();
return 1;
}
}
}
result = 0;
} else {
result = 0;
}
} else {
result = 0;
}
} else {
result = 0;
}
return result;
}
bool CMuunSystem::RemovePeriodMunnItemData(OBJECTSTRUCT *lpObj, WORD wItemCode, UINT64 dwSerial) {
bool result;
int iInventoryPosition;
if (lpObj) {
if (lpObj->Type == 1 && lpObj->Connected >= 2) {
iInventoryPosition = this->GetItemFromMuunInventory(lpObj, wItemCode, dwSerial);
if (iInventoryPosition == -1) {
result = 0;
} else {
this->SetDisableMuunItemToExpire(lpObj, iInventoryPosition);
result = 1;
}
} else {
result = 0;
}
} else {
result = 0;
}
return result;
}
bool CMuunSystem::SetDisableMuunItemToExpire(OBJECTSTRUCT *lpObj, int iInventoryPosition) {
bool result;
if (lpObj) {
if (lpObj->Connected >= 2 || lpObj->Type == 1) {
if (iInventoryPosition == -1) {
result = 0;
} else {
lpObj->pMuunInventory[iInventoryPosition].SetMuunItemPeriodExpire();
if (iInventoryPosition < 2) {
if (lpObj->pMuunInventory[iInventoryPosition].IsItem() == 1)
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[iInventoryPosition].nOptType);
}
GCMuunInventoryItemListSend(lpObj->m_Index);
result = 1;
}
} else {
result = 0;
}
} else {
result = 0;
}
return result;
}
void CMuunSystem::CheckMuunItemConditionLevelUp(OBJECTSTRUCT *lpObj) {
int nMaxLv;
CMuunOpt *pCMuunInfo;
int iRet = -1;
for (int i = 0; i < 2; ++i) {
if (lpObj->pMuunInventory[i].IsItem()) {
pCMuunInfo = lpObj->m_MuunEffectList[i].pCMuunInfo;
if (!pCMuunInfo)
return;
if (pCMuunInfo->GetConditionType() == 2) {
int nMinLv = pCMuunInfo->GetConditionVal1();
nMaxLv = pCMuunInfo->GetConditionVal2();
if (nMinLv > lpObj->Level || nMaxLv < lpObj->Level) {
if (lpObj->m_MuunEffectList[i].bOptEnable == 1) {
lpObj->m_MuunEffectList[i].bOptEnable = 0;
iRet = 0;
}
} else {
if (!lpObj->m_MuunEffectList[i].bOptEnable) {
lpObj->m_MuunEffectList[i].bOptEnable = 1;
iRet = 1;
}
}
if (iRet > -1) {
this->GCSendConditionStatus(lpObj->m_Index, i, iRet);
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[i].pCMuunInfo);
}
}
}
}
}
void CMuunSystem::CheckMuunItemMoveMapConditionMap(OBJECTSTRUCT *lpObj, int iMapNumber) {
CMuunOpt *pCMuunInfo;
for (int i = 0; i < 2; ++i) {
if (lpObj->pMuunInventory[i].IsItem() == 1) {
pCMuunInfo = lpObj->m_MuunEffectList[i].pCMuunInfo;
if (!pCMuunInfo)
return;
if (pCMuunInfo->GetConditionType() == 1) {
if (pCMuunInfo->GetConditionVal1() == iMapNumber) {
if (!lpObj->m_MuunEffectList[i].bOptEnable) {
lpObj->m_MuunEffectList[i].bOptEnable = 1;
this->GCSendConditionStatus(lpObj->m_Index, i, 1);
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[i].pCMuunInfo);
}
} else {
if (lpObj->m_MuunEffectList[i].bOptEnable == 1) {
lpObj->m_MuunEffectList[i].bOptEnable = 0;
this->GCSendConditionStatus(lpObj->m_Index, i, 0);
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[i].pCMuunInfo);
}
}
}
}
}
}
void CMuunSystem::CheckEquipMuunItemCondition(OBJECTSTRUCT *lpObj) {
int iRet;
for (int i = 0; i < 2; ++i) {
if (lpObj->pMuunInventory[i].IsItem() == 1) {
iRet = this->CheckMuunItemCondition(lpObj, &lpObj->m_MuunEffectList[i],
lpObj->m_MuunEffectList[i].pCMuunInfo);
if (iRet > -1)
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[i].pCMuunInfo);
if (iRet < 0)
iRet = 0;
this->GCSendConditionStatus(lpObj->m_Index, i, iRet);
}
}
}
void CMuunSystem::CheckEquipMuunItemConditionProc(OBJECTSTRUCT *lpObj) {
signed int iRet;
for (int i = 0; i < 2; ++i) {
if (lpObj->pMuunInventory[i].IsItem() == 1) {
iRet = this->CheckMuunItemConditionProc(&lpObj->m_MuunEffectList[i], lpObj->m_MuunEffectList[i].pCMuunInfo);
if (iRet > -1) {
this->GCSendConditionStatus(lpObj->m_Index, i, iRet);
this->CalCharacterStat(lpObj->m_Index, lpObj->m_MuunEffectList[i].pCMuunInfo);
}
}
}
}
void CMuunSystem::CalCharacterStat(int aIndex, CMuunInfo *pCMuunInfo) {
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] CalCharacterStat() pCMuunInfo is NULL [%d]", __LINE__);
return;
}
if (pCMuunInfo->GetOptType() == 7 || pCMuunInfo->GetOptType() == 1) {
gObjCalCharacter.CalcCharacter(aIndex);
}
}
void CMuunSystem::CalCharacterStat(int aIndex, int iOptType) {
if (iOptType == 7 || iOptType == 1) {
gObjCalCharacter.CalcCharacter(aIndex);
}
}
int
CMuunSystem::CheckMuunItemCondition(OBJECTSTRUCT *lpObj, _tagMUUN_EFFECT_LIST *pUserMuunEffect, CMuunInfo *pCMuunInfo) {
if (pCMuunInfo == NULL) {
g_Log.Add("[MuunSystem][Error] CheckMuunItemCondition() pCMuunInfo is NULL [%s][%s] [%d]", lpObj->AccountID,
lpObj->Name, __LINE__);
return -1;
}
switch (pCMuunInfo->GetConditionType()) {
case 3:
return this->ChkMuunOptConditionTime(pUserMuunEffect, pCMuunInfo);
case 4:
return this->ChkMuunOptConditionDay(pUserMuunEffect, pCMuunInfo);
case 2:
return this->ChkMuunOptConditionLevel(lpObj, pUserMuunEffect, pCMuunInfo);
case 1:
return this->ChkMuunOptConditionMap(lpObj, pUserMuunEffect, pCMuunInfo);
default:
return -1;
}
}
int CMuunSystem::CheckMuunItemConditionProc(_tagMUUN_EFFECT_LIST *pUserMuunEffect, CMuunInfo *pCMuunInfo) {
int result;
int iRet;
if (pCMuunInfo) {
iRet = -1;
int iConditionType = pCMuunInfo->GetConditionType();
if (iConditionType == 3) {
iRet = this->ChkMuunOptConditionTime(pUserMuunEffect, pCMuunInfo);
} else {
if (iConditionType == 4)
iRet = this->ChkMuunOptConditionDay(pUserMuunEffect, pCMuunInfo);
}
result = iRet;
} else {
g_Log.Add(
"[MuunSystem][Error] CheckMuunItemConditionProc() pCMuunInfo is NULL [%d]",
__LINE__);
result = -1;
}
return result;
}
int CMuunSystem::ChkMuunOptConditionTime(_tagMUUN_EFFECT_LIST *pUserMuunEffect, CMuunInfo *pCMuunInfo) {
if (pCMuunInfo == NULL) {
g_Log.Add("[MuunSystem][Error] ChkMuunOptConditionTime() pCMuunInfo is NULL [%d]", __LINE__);
return -1;
}
SYSTEMTIME tmToDay;
int nStartTime = pCMuunInfo->GetConditionVal1();
int nEndTime = pCMuunInfo->GetConditionVal2();
GetLocalTime(&tmToDay);
if (tmToDay.wHour < nStartTime || tmToDay.wHour >= nEndTime) {
if (pUserMuunEffect->bOptEnable == TRUE) {
pUserMuunEffect->bOptEnable = FALSE;
return FALSE;
}
} else {
if (pUserMuunEffect->bOptEnable == FALSE) {
pUserMuunEffect->bOptEnable = TRUE;
return TRUE;
}
}
return -1;
}
int CMuunSystem::ChkMuunOptConditionDay(_tagMUUN_EFFECT_LIST *pUserMuunEffect, CMuunInfo *pCMuunInfo) {
SYSTEMTIME tmToDay;
char DayOfWeek[7] = {64, 32, 16, 8, 4, 2, 1};
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] ChkMuunOptConditionDay() pCMuunInfo is NULL [%d]", __LINE__);
return -1;
}
GetLocalTime(&tmToDay);
if ((pCMuunInfo->GetConditionVal1() & DayOfWeek[tmToDay.wDayOfWeek]) != DayOfWeek[tmToDay.wDayOfWeek]) {
if (pUserMuunEffect->bOptEnable == TRUE) {
pUserMuunEffect->bOptEnable = FALSE;
return FALSE;
}
} else {
if (pUserMuunEffect->bOptEnable == FALSE) {
pUserMuunEffect->bOptEnable = TRUE;
return TRUE;
}
}
return -1;
}
int CMuunSystem::ChkMuunOptConditionLevel(OBJECTSTRUCT *lpObj, _tagMUUN_EFFECT_LIST *pUserMuunEffect,
CMuunInfo *pCMuunInfo) {
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] ChkMuunOptConditionLevel() pCMuunInfo is NULL [%d]", __LINE__);
return -1;
}
if (lpObj->Type != OBJ_USER) {
g_Log.Add("[MuunSystem][Error] ChkMuunOptConditionLevel() lpObj->Type != OBJ_USER", __LINE__);
return -1;
}
int nMinLv = pCMuunInfo->GetConditionVal1();
int nMaxLv = pCMuunInfo->GetConditionVal2();
if (nMinLv > (lpObj->Level + lpObj->m_PlayerData->MasterLevel) ||
nMaxLv < (lpObj->Level + lpObj->m_PlayerData->MasterLevel)) {
pUserMuunEffect->bOptEnable = FALSE;
return FALSE;
} else {
pUserMuunEffect->bOptEnable = TRUE;
return TRUE;
}
}
int
CMuunSystem::ChkMuunOptConditionMap(OBJECTSTRUCT *lpObj, _tagMUUN_EFFECT_LIST *pUserMuunEffect, CMuunInfo *pCMuunInfo) {
if (!pCMuunInfo) {
g_Log.Add("[MuunSystem][Error] ChkMuunOptConditionMap() pCMuunInfo is NULL [%d]", __LINE__);
return -1;
}
if (pCMuunInfo->GetConditionVal1() == lpObj->MapNumber) {
pUserMuunEffect->bOptEnable = TRUE;
return TRUE;
} else {
pUserMuunEffect->bOptEnable = FALSE;
return FALSE;
}
}
int CMuunSystem::GetItemFromMuunInventory(OBJECTSTRUCT *lpObj, WORD wItemCode, UINT64 dwSerial) {
if (!lpObj) {
return -1;
}
if (lpObj->Type != OBJ_USER) {
return -1;
}
if (lpObj->Connected < PLAYER_LOGGED) {
return -1;
}
for (int i = 0; i < MUUN_INVENTORY_SIZE; i++) {
if (lpObj->pMuunInventory[i].IsItem() == TRUE && lpObj->pMuunInventory[i].m_Type == wItemCode &&
lpObj->pMuunInventory[i].GetNumber() == dwSerial) {
return i;
}
}
return -1;
}
time_t CMuunSystem::GetCurrentDate() {
return time(NULL);
}
time_t CMuunSystem::GetExpireDate(int iDuration) {
time_t expiretime = time(NULL);
expiretime += iDuration;
return expiretime;
}
bool CMuunSystem::CheckExpireDate(time_t dwItemExpireDate) {
return this->GetCurrentDate() > dwItemExpireDate;
}
time_t CMuunSystem::GetLeftDate(time_t ExpireDate) // unused
{
time_t currtime = time(NULL);
time_t difftime = ExpireDate - currtime;
return difftime;
}
bool CMuunSystem::CheckAddOptionExpireDate(time_t dwStartDate, time_t dwEndDate) {
bool result;
int dwCurrentDate;
dwCurrentDate = this->GetCurrentDate();
if (dwCurrentDate >= dwStartDate)
result = dwCurrentDate < dwStartDate || dwCurrentDate > dwEndDate;
else
result = 0;
return result;
}
void CMuunSystem::MsgIsMuunItemActive(OBJECTSTRUCT *lpObj, int iPos) {
//trash
}
bool CMuunSystem::LoadScriptMuunExchange(char *lpszFileName) {
pugi::xml_document file;
pugi::xml_parse_result res = file.load_file(lpszFileName);
if (res.status != pugi::status_ok) {
g_Log.MsgBox("[MuunSystem] Cannot load %s file! (%s)", lpszFileName, res.description());
return false;
}
pugi::xml_node main = file.child("MuunSystem");
pugi::xml_node energy_converter = main.child("EnergyConvertSettings");
this->m_iStoneOfEvolutionPt = energy_converter.attribute("StoneOfEvolutionPoint").as_int();
int iCount = 0;
for (pugi::xml_node muun = energy_converter.child("Muun"); muun; muun = muun.next_sibling()) {
if (iCount >= 8) {
g_Log.MsgBox("Exceed max entries (StoneOfEvolutionPoint)");
break;
}
this->m_stEnergyGeneratorPoint[iCount].iRank = muun.attribute("Rank").as_int();
this->m_stEnergyGeneratorPoint[iCount].iRankPt = muun.attribute("RankPoint").as_int();
this->m_stEnergyGeneratorPoint[iCount].iMuunLv = muun.attribute("Level").as_int();
this->m_stEnergyGeneratorPoint[iCount].iMuunLvPt = muun.attribute("LevelPoint").as_int();
iCount++;
}
pugi::xml_node required_items = main.child("RequiredItemsExchange");
iCount = 0;
for (pugi::xml_node item = required_items.child("Item"); item; item = item.next_sibling()) {
if (iCount >= 10) {
g_Log.MsgBox("Exceed max entries (RequiredItemsExchange)");
break;
}
this->m_stMuunExchangeInfo[iCount].iItemType = item.attribute("Cat").as_int();
this->m_stMuunExchangeInfo[iCount].iItemIndex = item.attribute("Index").as_int();
this->m_stMuunExchangeInfo[iCount].iInvenChk = item.attribute("InventoryCheck").as_int();
this->m_stMuunExchangeInfo[iCount].iItemCnt = item.attribute("ItemCount").as_int();
this->m_stMuunExchangeInfo[iCount].iItemBagIndex = item.attribute("ItemBagIndex").as_int();
iCount++;
}
pugi::xml_node bag_list = main.child("BagListSettings");
iCount = 0;
for (pugi::xml_node bag = bag_list.child("Bag"); bag; bag = bag.next_sibling()) {
if (iCount >= 20) {
g_Log.MsgBox("Exceed max entries (BagListSettings)");
break;
}
this->m_stMuunExchangeItembag[iCount].iIndex = bag.attribute("Index").as_int();
this->m_stMuunExchangeItembag[iCount].iItemType = bag.attribute("ItemCat").as_int();
this->m_stMuunExchangeItembag[iCount].iItemIndex = bag.attribute("ItemIndex").as_int();
this->m_stMuunExchangeItembag[iCount].iMinLv = bag.attribute("ItemMinLevel").as_int();
this->m_stMuunExchangeItembag[iCount].iMaxLv = bag.attribute("ItemMaxLevel").as_int();
this->m_stMuunExchangeItembag[iCount].iSkill = bag.attribute("Skill").as_int();
this->m_stMuunExchangeItembag[iCount].iLuck = bag.attribute("Luck").as_int();
this->m_stMuunExchangeItembag[iCount].iAddOpt = bag.attribute("Option").as_int();
this->m_stMuunExchangeItembag[iCount].iExItem = bag.attribute("Exc").as_int();
this->m_stMuunExchangeItembag[iCount].iStoneMuunItemType = bag.attribute("MuunEvoItemCat").as_int();
this->m_stMuunExchangeItembag[iCount].iStoneMuunItemIndex = bag.attribute("MuunEvoItemIndex").as_int();
this->m_stMuunExchangeItembag[iCount].iInvenChk = bag.attribute("InventoryCheck").as_int();
iCount++;
}
return true;
}
void CMuunSystem::CGMuunExchangeItem(PMSG_REQ_MUUN_EXCHANGE *lpMsg, int aIndex) {
if (!ObjectMaxRange(aIndex)) {
return;
}
if (gObjIsConnected(aIndex) == FALSE) {
return;
}
BYTE nSelect = lpMsg->btSelect;
if (nSelect >= 10) {
g_Log.Add("[MuunSystem][MuunExchange][Error][%s][%s] Select Over %d [%s, %d]", gObj[aIndex].AccountID,
gObj[aIndex].Name, nSelect, __FILE__, __LINE__);
return;
}
if (this->ChkMuunExchangeInvenNeedItem(&gObj[aIndex], nSelect, 0) == FALSE) {
g_Log.Add("[MuunSystem][MuunExchange][FAIL][%s][%s] Lack of Materials", gObj[aIndex].AccountID,
gObj[aIndex].Name);
this->SendMsgMuunExchange(aIndex, 1);
return;
}
if (this->ChkMuunExchangeInvenEmpty(&gObj[aIndex], nSelect) == FALSE) {
g_Log.Add("[MuunSystem][MuunExchange][FAIL][%s][%s] Not Empty Space", gObj[aIndex].AccountID,
gObj[aIndex].Name);
this->SendMsgMuunExchange(aIndex, 2);
return;
}
this->GDMuunExchangeInsertInven(&gObj[aIndex], nSelect);
}
bool CMuunSystem::GDMuunExchangeInsertInven(LPOBJ lpObj, int iSelect) {
if (!ObjectMaxRange(lpObj->m_Index)) {
return false;
}
if (!gObjIsConnected(lpObj->m_Index)) {
return false;
}
float fDur = 0.0;
int iType = 0;
int iLevel = 0;
BYTE Y = 0;
int iOption1 = 0;
int iOption2 = 0;
int iOption3 = 0;
int iExOption = 0;
int nSelect = iSelect;
int nItemBagIndex = this->m_stMuunExchangeInfo[iSelect].iItemBagIndex;
int level = 0;
if (this->m_stMuunExchangeItembag[nItemBagIndex].iMinLv == this->m_stMuunExchangeItembag[nItemBagIndex].iMaxLv) {
level = this->m_stMuunExchangeItembag[nItemBagIndex].iMinLv;
} else {
int sub = this->m_stMuunExchangeItembag[nItemBagIndex].iMaxLv -
this->m_stMuunExchangeItembag[nItemBagIndex].iMinLv + 1;
level = this->m_stMuunExchangeItembag[nItemBagIndex].iMinLv + rand() % sub;
}
iLevel = level;
iType = ItemGetNumberMake(this->m_stMuunExchangeItembag[nItemBagIndex].iItemType,
this->m_stMuunExchangeItembag[nItemBagIndex].iItemIndex);
if (iType == -1) {
return false;
}
BYTE SocketOption[5];
memset(SocketOption, -1, sizeof(SocketOption));
if (this->IsStoneofEvolution(iType) == true) {
int nItemIndex = this->m_stMuunExchangeItembag[nItemBagIndex].iStoneMuunItemIndex;
SocketOption[0] = (nItemIndex + (this->m_stMuunExchangeItembag[nItemBagIndex].iStoneMuunItemType << 9)) >> 8;
SocketOption[1] = nItemIndex;
}
if (this->m_stMuunExchangeItembag[nItemBagIndex].iSkill) {
iOption1 = TRUE;
}
if (this->m_stMuunExchangeItembag[nItemBagIndex].iLuck) {
iOption2 = FALSE;
if ((rand() % 2) == 0) {
iOption2 = TRUE;
}
}
LPITEM_ATTRIBUTE ItemAttribute = GetItemAttr(iType);
if (ItemAttribute == NULL) {
return false;
}
if (this->m_stMuunExchangeItembag[nItemBagIndex].iExItem) {
iExOption = g_ItemOptionTypeMng.CommonExcOptionRand(ItemAttribute->ItemKindA);
iOption2 = FALSE;
iOption1 = TRUE;
iLevel = 0;
}
if (this->m_stMuunExchangeItembag[nItemBagIndex].iAddOpt) {
if ((rand() % 5) == 0) {
iOption3 = 3;
} else {
iOption3 = rand() % 3;
}
}
if (iType == ITEMGET(12, 15) || iType == ITEMGET(14, 13) || iType == ITEMGET(14, 14)) {
iOption1 = FALSE;
iOption2 = FALSE;
iOption3 = FALSE;
iLevel = 0;
}
if (iType == ITEMGET(14, 70) || iType == ITEMGET(14, 71))
fDur = 50.0;
if (iType == ITEMGET(14, 85) || iType == ITEMGET(14, 86) || iType == ITEMGET(14, 87))
fDur = 10.0;
if (iType == ITEMGET(14, 53))
fDur = 10.0;
ItemSerialCreateSend(lpObj->m_Index, 218, nSelect, Y, iType, iLevel, fDur, iOption1, iOption2, iOption3,
lpObj->m_Index, iExOption, 0, 0, SocketOption, 0);
g_Log.Add(
"[MuunSystem][MuunExchange][ItemSerialCreateSend] [%s][%s] : Item:(%s)%d Level:%d op1:%d op2:%d op3:%d ExOp:%d",
lpObj->AccountID, lpObj->Name, ItemAttribute->Name, iType, iLevel, iOption1, iOption2, iOption3, iExOption);
return true;
}
BYTE CMuunSystem::DGMuunExchangeInsertInven(LPOBJ lpObj, CItem CreateItem, int iSelect) {
if (!ObjectMaxRange(lpObj->m_Index)) {
return false;
}
if (!gObjIsConnected(lpObj->m_Index)) {
return false;
}
BYTE btRet = -1;
int nItemBagIndex = this->m_stMuunExchangeInfo[iSelect].iItemBagIndex;
int nChkInven = this->m_stMuunExchangeItembag[nItemBagIndex].iInvenChk;
if (this->ChkAndDelItemMuunExchange(lpObj, iSelect) == false) {
g_Log.Add("[MuunSystem][MuunExchange][ItemSerialCreateRecv][ItemDelFail][%s][%s][%d]",
lpObj->AccountID, lpObj->Name, iSelect);
return btRet;
}
if (nChkInven == 22) {
btRet = gObjMuunInventoryInsertItem(lpObj->m_Index, CreateItem);
if (btRet != 0xFF) {
GSProtocol.GCMuunInventoryItemOneSend(lpObj->m_Index, btRet);
this->SendMsgMuunExchange(lpObj->m_Index, 0);
return btRet;
}
} else if (nChkInven == 0) {
btRet = gObjInventoryInsertItem(lpObj->m_Index, CreateItem);
if (btRet != 0xFF) {
GSProtocol.GCInventoryItemOneSend(lpObj->m_Index, btRet);
this->SendMsgMuunExchange(lpObj->m_Index, 0);
return btRet;
}
} else {
g_Log.Add("[MuunSystem][MuunExchange][Error][%s][%s] DGMuunExchangeInsertInven() ChkInven %d [%s, %d]",
lpObj->AccountID, lpObj->Name, nChkInven, __FILE__, __LINE__);
return btRet;
}
this->SendMsgMuunExchange(lpObj->m_Index, 2);
g_Log.Add("[MuunSystem][MuunExchange][FAIL][%s][%s] Not Empty Space", lpObj->AccountID, lpObj->Name);
return btRet;
}
bool CMuunSystem::ChkAndDelItemMuunExchange(LPOBJ lpObj, int iSelect) {
int ItemPos[10];
memset(ItemPos, -1, sizeof(ItemPos));
int nNeedItemCnt = this->m_stMuunExchangeInfo[iSelect].iItemCnt;
int nNeedItemNum = ITEMGET(this->m_stMuunExchangeInfo[iSelect].iItemType,
this->m_stMuunExchangeInfo[iSelect].iItemIndex);
int nChkInven = this->m_stMuunExchangeInfo[iSelect].iInvenChk;
if (this->ChkMuunExchangeInvenNeedItem(lpObj, iSelect, ItemPos) == false) {
return false;
}
if (nChkInven == 22) {
for (int nMuunInven = 0; nMuunInven < nNeedItemCnt; nMuunInven++) {
int nItemPos = ItemPos[nMuunInven];
if (nItemPos == -1) {
break;
}
if (lpObj->pMuunInventory[nItemPos].IsItem() == TRUE &&
lpObj->pMuunInventory[nItemPos].m_Type == nNeedItemNum) {
BYTE NewOption[MAX_EXOPTION_SIZE];
ItemIsBufExOption(NewOption, &lpObj->pMuunInventory[nItemPos]);
g_Log.Add(
"[MuunSystem][MuunExchange] Delete MuunInven Item [%s][%s] Delete Item Info - Item:[%s,%d,%d,%d,%d] serial:[%I64d][%d] Ex:[%d,%d,%d,%d,%d,%d,%d] Set[%d] 380:[%d] HO:[%d,%d] SC[%d,%d,%d,%d,%d] BonusOption[%d]",
lpObj->AccountID, lpObj->Name, lpObj->pMuunInventory[nItemPos].GetName(),
lpObj->pMuunInventory[nItemPos].m_Level, lpObj->pMuunInventory[nItemPos].m_Option1,
lpObj->pMuunInventory[nItemPos].m_Option2, lpObj->pMuunInventory[nItemPos].m_Option3,
lpObj->pMuunInventory[nItemPos].m_Number, (int) lpObj->pMuunInventory[nItemPos].m_Durability,
NewOption[0], NewOption[1], NewOption[2], NewOption[3], NewOption[4], NewOption[5],
NewOption[6], lpObj->pMuunInventory[nItemPos].m_SetOption,
lpObj->pMuunInventory[nItemPos].m_ItemOptionEx >> 7,
g_kJewelOfHarmonySystem.GetItemStrengthenOption(&lpObj->pMuunInventory[nItemPos]),
g_kJewelOfHarmonySystem.GetItemOptionLevel(&lpObj->pMuunInventory[nItemPos]),
lpObj->pMuunInventory[nItemPos].m_SocketOption[0],
lpObj->pMuunInventory[nItemPos].m_SocketOption[1],
lpObj->pMuunInventory[nItemPos].m_SocketOption[2],
lpObj->pMuunInventory[nItemPos].m_SocketOption[3],
lpObj->pMuunInventory[nItemPos].m_SocketOption[4],
lpObj->pMuunInventory[nItemPos].m_BonusSocketOption);
this->ClearPeriodMuunItemData(lpObj, lpObj->pMuunInventory[nItemPos].m_Type,
lpObj->pMuunInventory[nItemPos].m_Number);
lpObj->pMuunInventory[nItemPos].Clear();
GSProtocol.GCMuunInventoryItemDeleteSend(lpObj->m_Index, nItemPos, 1);
}
}
} else if (nChkInven == 0) {
for (int nInven = 0; nInven < nNeedItemCnt; nInven++) {
int nItemPos = ItemPos[nInven];
if (nItemPos == -1) {
break;
}
if (lpObj->pInventory[nItemPos].IsItem() == TRUE &&
lpObj->pInventory[nItemPos].m_Type == nNeedItemNum) {
BYTE NewOption[MAX_EXOPTION_SIZE];
ItemIsBufExOption(NewOption, &lpObj->pMuunInventory[nItemPos]);
g_Log.Add(
"[MuunSystem][MuunExchange] Delete Inven Item [%s][%s] Delete Item Info - Item:[%s,%d,%d,%d,%d] serial:[%I64d][%d] Ex:[%d,%d,%d,%d,%d,%d,%d] Set[%d] 380:[%d] HO:[%d,%d] SC[%d,%d,%d,%d,%d] BonusOption[%d]",
lpObj->AccountID, lpObj->Name, lpObj->pInventory[nItemPos].GetName(),
lpObj->pInventory[nItemPos].m_Level, lpObj->pInventory[nItemPos].m_Option1,
lpObj->pInventory[nItemPos].m_Option2, lpObj->pInventory[nItemPos].m_Option3,
lpObj->pInventory[nItemPos].m_Number, (int) lpObj->pInventory[nItemPos].m_Durability,
NewOption[0], NewOption[1], NewOption[2], NewOption[3], NewOption[4], NewOption[5],
NewOption[6], lpObj->pInventory[nItemPos].m_SetOption,
lpObj->pInventory[nItemPos].m_ItemOptionEx >> 7,
g_kJewelOfHarmonySystem.GetItemStrengthenOption(&lpObj->pInventory[nItemPos]),
g_kJewelOfHarmonySystem.GetItemOptionLevel(&lpObj->pInventory[nItemPos]),
lpObj->pInventory[nItemPos].m_SocketOption[0], lpObj->pInventory[nItemPos].m_SocketOption[1],
lpObj->pInventory[nItemPos].m_SocketOption[2], lpObj->pInventory[nItemPos].m_SocketOption[3],
lpObj->pInventory[nItemPos].m_SocketOption[4],
lpObj->pInventory[nItemPos].m_BonusSocketOption);
gObjInventoryItemSet(lpObj->m_Index, nItemPos, -1);
lpObj->pInventory[nItemPos].Clear();
GSProtocol.GCInventoryItemDeleteSend(lpObj->m_Index, nItemPos, 1);
}
}
} else {
g_Log.Add("[MuunSystem][MuunExchange][Error][%s][%s] ChkAndDelItemMuunExchange() ChkInven %d [%s, %d]",
lpObj->AccountID, lpObj->Name, nChkInven, __FILE__, __LINE__);
return false;
}
return true;
}
bool CMuunSystem::ChkMuunExchangeInvenNeedItem(int &iItemCnt, int iInvenPos, int iNeedItemCnt, int iInvenItemNum,
int iNeedItemNum, int *ItemPos) {
if (iInvenItemNum != iNeedItemNum) {
return false;
}
if (ItemPos != 0) {
if (iItemCnt < 10) {
ItemPos[iItemCnt] = iInvenPos;
}
}
iItemCnt++;
if (iItemCnt < iNeedItemCnt) {
return false;
}
return true;
}
bool CMuunSystem::ChkMuunExchangeInvenNeedItem(LPOBJ lpObj, int iSelect, int *ItemPos) {
int nItemCnt = 0;
int nNeedItemCnt = this->m_stMuunExchangeInfo[iSelect].iItemCnt;
int nNeedItemNum = ITEMGET(this->m_stMuunExchangeInfo[iSelect].iItemType,
this->m_stMuunExchangeInfo[iSelect].iItemIndex);
int nChkInven = this->m_stMuunExchangeInfo[iSelect].iInvenChk;
if (nChkInven == 22) {
for (int nMuunInven = 2; nMuunInven < MUUN_INVENTORY_SIZE; nMuunInven++) {
if (lpObj->pMuunInventory[nMuunInven].IsItem() == TRUE &&
this->ChkMuunExchangeInvenNeedItem(nItemCnt, nMuunInven, nNeedItemCnt,
lpObj->pMuunInventory[nMuunInven].m_Type, nNeedItemNum, ItemPos) ==
TRUE) {
return TRUE;
}
}
} else if (nChkInven == 0) {
for (int nInven = INVETORY_WEAR_SIZE; nInven < MAIN_INVENTORY_SIZE; nInven++) {
if (lpObj->pInventory[nInven].IsItem() == TRUE &&
this->ChkMuunExchangeInvenNeedItem(nItemCnt, nInven, nNeedItemCnt, lpObj->pInventory[nInven].m_Type,
nNeedItemNum, ItemPos) == TRUE) {
return TRUE;
}
}
} else {
g_Log.Add("[MuunSystem][MuunExchange][Error][%s][%s] ChkMuunExchangeInvenNeedItem() ChkInven %d [%s, %d]",
lpObj->AccountID, lpObj->Name, nChkInven, __FILE__, __LINE__);
return FALSE;
}
g_Log.Add("[MuunSystem][MuunExchange][FAIL][%s][%s] Lack of Materials", lpObj->AccountID, lpObj->Name);
this->SendMsgMuunExchange(lpObj->m_Index, 1);
return false;
}
bool CMuunSystem::ChkMuunExchangeInvenEmpty(LPOBJ lpObj, int iSelect) {
int nChkInven = this->m_stMuunExchangeItembag[this->m_stMuunExchangeInfo[iSelect].iItemBagIndex].iInvenChk;
if (nChkInven == 22) {
if (gObjChkMuunInventoryEmpty(lpObj) == 0xFF) {
this->SendMsgMuunExchange(lpObj->m_Index, 2);
return false;
}
} else if (nChkInven == 0) {
if (CheckInventoryEmptySpace(lpObj, 4, 4) == FALSE) {
this->SendMsgMuunExchange(lpObj->m_Index, 2);
return false;
}
} else {
g_Log.Add("[MuunSystem][MuunExchange][Error][%s][%s] ChkMuunExchangeInvenEmpty() ChkInven %d [%s, %d]",
lpObj->AccountID, lpObj->Name, nChkInven, __FILE__, __LINE__);
return false;
}
return true;
}
void CMuunSystem::SendMsgMuunExchange(int aIndex, int iResult) {
PMSG_ANS_MUUN_EXCHANGE pMsg;
pMsg.btResult = iResult;
PHeadSubSetB((LPBYTE) & pMsg, 0x4E, 0x13, sizeof(pMsg));
IOCP.DataSend(aIndex, (LPBYTE) & pMsg, pMsg.h.size);
}
void CMuunSystem::SetTarget(LPOBJ lpObj, int aTargetIndex) {
for (int i = 0; i < 2; i++) {
if (lpObj->m_MuunEffectList[i].nOptType == 50 || lpObj->m_MuunEffectList[i].nOptType == 52) {
lpObj->m_MuunEffectList[i].nTargetIndex = aTargetIndex;
}
if (lpObj->m_MuunEffectList[i].nOptType == 53) {
if (gObj[aTargetIndex].Type != OBJ_USER) {
lpObj->m_MuunEffectList[i].nTargetIndex = aTargetIndex;
}
}
}
}
void CMuunSystem::ReSetTarget(LPOBJ lpObj, int aTargetIndex) {
for (int i = 0; i < 2; i++) {
if (lpObj->m_MuunEffectList[i].nOptType == 50 || lpObj->m_MuunEffectList[i].nOptType == 52 ||
lpObj->m_MuunEffectList[i].nOptType == 53) {
lpObj->m_MuunEffectList[i].nTargetIndex = -1;
}
}
}
void CMuunSystem::CGReqRideSelect(PMSG_MUUN_RIDE_SELECT *lpMsg, int aIndex) {
if (!ObjectMaxRange(aIndex))
return;
if (!gObjIsConnected(aIndex))
return;
LPOBJ lpObj = &gObj[aIndex];
lpObj->m_wMuunRideItem = -1;
for (int i = 0; i < 2; i++) {
int nItemNum = lpObj->pMuunInventory[i].m_Type;
if (nItemNum == lpMsg->wItemNum) {
lpObj->m_wMuunRideItem = nItemNum;
break;
}
}
_tagMuunRideViewPortInfo MuunViewPortInfo;
BYTE btMuunInfosendBuf[2048];
MuunViewPortInfo.NumberH = SET_NUMBERH(lpObj->m_Index);
MuunViewPortInfo.NumberL = SET_NUMBERL(lpObj->m_Index);
MuunViewPortInfo.MuunRideItemH = SET_NUMBERH(lpObj->m_wMuunRideItem);
MuunViewPortInfo.MuunRideItemL = SET_NUMBERL(lpObj->m_wMuunRideItem);
if (lpObj->m_wMuunRideItem == 0xFFFF) {
MuunViewPortInfo.MuunRideItemH = SET_NUMBERH(lpObj->m_wInvenPet);
MuunViewPortInfo.MuunRideItemL = SET_NUMBERL(lpObj->m_wInvenPet);
}
PMSG_SEND_MUUN_RIDE_VIEWPORT_INFO pMsgMuun;
int lOfs = sizeof(pMsgMuun);
memcpy(&btMuunInfosendBuf[lOfs], &MuunViewPortInfo, 4);
lOfs += sizeof(_tagMuunRideViewPortInfo);
pMsgMuun.Count = 1;
pMsgMuun.h.set((LPBYTE) & pMsgMuun, 0x4E, 0x14, lOfs);
memcpy(btMuunInfosendBuf, &pMsgMuun, sizeof(pMsgMuun));
IOCP.DataSend(lpObj->m_Index, btMuunInfosendBuf, lOfs);
for (int n = 0; n < MAX_VIEWPORT; n++) {
if (lpObj->VpPlayer2[n].state != 0) {
int tObjNum = lpObj->VpPlayer2[n].number;
if (tObjNum >= 0 && lpObj->VpPlayer2[n].type == OBJ_USER) {
IOCP.DataSend(tObjNum, btMuunInfosendBuf, lOfs);
}
}
}
}
void CMuunSystem::SkillProc(LPOBJ lpObj) {
this->m_MuunAttack.SkillProc(lpObj);
}
bool CMuunSystem::IsMuunExpireDate(int iType) {
if (this->IsMuunItem(iType) == false) {
return false;
}
CMuunInfo *pCMuunInfo = this->m_MuunInfoMng.GetMuunItemNumToMuunInfo(iType);
if (!pCMuunInfo) {
return false;
}
if (this->CheckAddOptionExpireDate(pCMuunInfo->GetAddOptStart(), pCMuunInfo->GetAddOptEnd()) == true) {
return true;
}
return false;
}
void CMuunSystem::Attack(LPOBJ lpObj, LPOBJ lpTargetObj, CMagicInf *lpMagic, int SubCode, int SubCode2) {
switch (SubCode) {
case 50:
this->m_MuunAttack.Attack(lpObj, lpTargetObj, lpMagic, SubCode2);
break;
case 51:
this->m_MuunAttack.DamageAbsorb(lpObj, lpTargetObj, lpMagic, SubCode2);
break;
case 52:
this->m_MuunAttack.Stun(lpObj, lpTargetObj, lpMagic, SubCode2);
break;
case 53:
this->m_MuunAttack.Attack(lpObj, lpTargetObj, lpMagic, SubCode2);
break;
}
}
| 37.924599
| 233
| 0.59138
|
millerp
|
63e2bf869d290c99bead137280fe0d613809a6c7
| 15,512
|
cpp
|
C++
|
src/cmsnews.cpp
|
NuLL3rr0r/samsungdforum-ir
|
f293631bbb7b96f854e7b89b286251d56ea70690
|
[
"MIT",
"Unlicense"
] | null | null | null |
src/cmsnews.cpp
|
NuLL3rr0r/samsungdforum-ir
|
f293631bbb7b96f854e7b89b286251d56ea70690
|
[
"MIT",
"Unlicense"
] | null | null | null |
src/cmsnews.cpp
|
NuLL3rr0r/samsungdforum-ir
|
f293631bbb7b96f854e7b89b286251d56ea70690
|
[
"MIT",
"Unlicense"
] | null | null | null |
/**********************************
* = Header File Inclusion =
**********************************/
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WDialog>
#include <Wt/WGridLayout>
#include <Wt/WLengthValidator>
#include <Wt/WLineEdit>
#include <Wt/WMessageBox>
#include <Wt/WPushButton>
#include <Wt/WSignalMapper>
#include <Wt/WTable>
#include <Wt/WText>
#include <Wt/WTextArea>
#include <Wt/WWidget>
#include "cmsnews.hpp"
#include "base.hpp"
#include "cdate.hpp"
#include "crypto.hpp"
#include "db.hpp"
#include "dbtables.hpp"
/**********************************
* = PreProcessor Directives =
**********************************/
/**********************************
* = Importing NameSpaces =
**********************************/
using namespace std;
using namespace boost;
using namespace Wt;
using namespace cppdb;
using namespace SamsungDForumIr;
/**********************************
* = Constants =
**********************************/
/**********************************
* = Enumerations =
**********************************/
/**********************************
* = Properties =
**********************************/
/**********************************
* = Fields =
**********************************/
/**********************************
* = Constructos =
**********************************/
CmsNews::CmsNews(CgiRoot *cgi) : BaseWidget(cgi)
{
this->clear();
this->addWidget(Layout());
}
/**********************************
* = Destructor =
**********************************/
/**********************************
* = Public Methods =
**********************************/
/**********************************
* = Event Handlers =
**********************************/
void CmsNews::OnAddButtonPressed()
{
m_dlg = new WDialog(m_lang->GetString("ROOT_CMSNEWS_ADD_DLG_TITLE"));
m_dlg->setModal(true);
m_dlg->contents()->addWidget(GetAddNewsForm());
m_dlg->rejectWhenEscapePressed();
m_dlg->show();
// HACK for 3.2.3-rc1
if (m_dlg->height().value() < 415)
m_dlg->resize(WLength::Auto, 415);
}
void CmsNews::OnAddDialogAddButtonPressed()
{
if(!Validate(m_titleLineEdit) || !Validate(m_bodyTextArea)) {
return;
}
CDate::Now n;
WString date;
switch(m_cgiEnv->CurrentLang) {
case CgiEnv::ELang_RootEn:
date = WString::fromUTF8(CDate::DateConv::ToGregorian(n));
break;
case CgiEnv::ELang_RootFa:
date = CDate::DateConv::FormatToPersianNums(CDate::DateConv::ToJalali(n));
break;
default:
break;
}
m_db->Insert(m_dbTables->Table("NEWS"), "title, body, date, archived", 4,
Crypto::Encrypt(trim_copy(m_titleLineEdit->text().toUTF8())).c_str(),
Crypto::Encrypt(trim_copy(m_bodyTextArea->text().toUTF8())).c_str(),
Crypto::Encrypt(date.toUTF8()).c_str(), "0");
FillNewsDataTable();
delete m_dlg;
m_dlg = NULL;
}
void CmsNews::OnAddDialogReturnButtonPressed()
{
delete m_dlg;
m_dlg = NULL;
}
void CmsNews::OnArchiveButtonPressed(Wt::WPushButton *sender)
{
string id(sender->attributeValue("dbid").toUTF8());
result r = m_db->Sql() << "SELECT archived FROM ["
+ m_dbTables->Table("NEWS")
+ "] WHERE rowid=?;" << id << row;
if (!r.empty()) {
string archived;
r >> archived;
if (archived == "0") {
m_db->Update(m_dbTables->Table("NEWS"), "rowid", id, "archived=?", 1, "1");
} else {
m_db->Update(m_dbTables->Table("NEWS"), "rowid", id, "archived=?", 1, "0");
}
}
FillNewsDataTable();
}
void CmsNews::OnEditButtonPressed(Wt::WPushButton *sender)
{
m_tableEditButton = sender;
string id(sender->attributeValue("dbid").toUTF8());
m_dlg = new WDialog(m_lang->GetString("ROOT_CMSNEWS_EDIT_DLG_TITLE"));
m_dlg->setModal(true);
m_dlg->contents()->addWidget(GetEditNewsForm(id));
m_dlg->rejectWhenEscapePressed();
m_dlg->show();
// HACK for 3.2.3-rc1
if (m_dlg->height().value() < 415)
m_dlg->resize(WLength::Auto, 415);
}
void CmsNews::OnEditDialogEditButtonPressed()
{
if(!Validate(m_titleLineEdit) || !Validate(m_bodyTextArea)) {
return;
}
string id(m_tableEditButton->attributeValue("dbid").toUTF8());
m_db->Update(m_dbTables->Table("NEWS"), "rowid", id, "title=?, body=?", 2,
Crypto::Encrypt(trim_copy(m_titleLineEdit->text().toUTF8())).c_str(),
Crypto::Encrypt(trim_copy(m_bodyTextArea->text().toUTF8())).c_str());
FillNewsDataTable();
delete m_dlg;
m_dlg = NULL;
m_tableEditButton = NULL;
}
void CmsNews::OnEditDialogReturnButtonPressed()
{
delete m_dlg;
m_dlg = NULL;
}
void CmsNews::OnEraseButtonPressed(Wt::WPushButton *sender)
{
m_tableEraseButton = sender;
wstring question((wformat(m_lang->GetString("ROOT_CMSNEWS_ERASE_MSG_QUESTION"))
% m_tableEraseButton->attributeValue("dbid").value()).str());
m_msg = new WMessageBox(m_lang->GetString("ROOT_CMSNEWS_ERASE_MSG_TITLE"),
question, Warning, NoButton);
m_msg->addButton(m_lang->GetString("ROOT_CMSNEWS_ERASE_MSG_OK_BUTTON"), Ok);
m_msg->addButton(m_lang->GetString("ROOT_CMSNEWS_ERASE_MSG_CANCEL_BUTTON"), Cancel);
m_msg->buttonClicked().connect(this, &CmsNews::OnEraseMessageBoxClosed);
m_msg->show();
}
void CmsNews::OnEraseMessageBoxClosed(Wt::StandardButton result)
{
if (result == Ok) {
string id(m_tableEraseButton->attributeValue("dbid").toUTF8());
cppdb::result r = m_db->Sql() << "SELECT rowid FROM ["
+ m_dbTables->Table("NEWS")
+ "] WHERE rowid=?;" << id << row;
if (!r.empty()) {
m_db->Delete(m_dbTables->Table("NEWS"), "rowid", id);
}
FillNewsDataTable();
}
delete m_msg;
m_msg = NULL;
m_tableEraseButton = NULL;
}
/**********************************
* = Protected Methods =
**********************************/
/**********************************
* = Private Methods =
**********************************/
void CmsNews::FillNewsDataTable()
{
m_dvNewsTable->clear();
WTable *newsTable = new WTable(m_dvNewsTable);
newsTable->setStyleClass("tbl");
newsTable->elementAt(0, 0)->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_NO_TEXT")));
newsTable->elementAt(0, 1)->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_TITLE_TEXT")));
newsTable->elementAt(0, 2)->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_DATE_TEXT")));
newsTable->elementAt(0, 3)->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_ARCHIVED_TEXT")));
newsTable->elementAt(0, 4)->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_EDIT_TEXT")));
newsTable->elementAt(0, 5)->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_ERASE_TEXT")));
newsTable->elementAt(0, 0)->setStyleClass("tblHeader");
newsTable->elementAt(0, 1)->setStyleClass("tblHeader");
newsTable->elementAt(0, 2)->setStyleClass("tblHeader");
newsTable->elementAt(0, 3)->setStyleClass("tblHeader");
newsTable->elementAt(0, 4)->setStyleClass("tblHeader");
newsTable->elementAt(0, 5)->setStyleClass("tblHeader");
result r = m_db->Sql() << "SELECT rowid, title, date, archived FROM ["
+ m_dbTables->Table("NEWS")
+ "] ORDER BY rowid DESC";
size_t i = 0;
while(r.next()) {
++i;
size_t rowid;
string title;
string date;
string archived;
r >> rowid >> title >> date >> archived;
title = Crypto::Decrypt(title);
date = Crypto::Decrypt(date);
newsTable->elementAt(i, 0)->addWidget(new WText(lexical_cast<wstring>(i)));
newsTable->elementAt(i, 1)->addWidget(new WText(WString::fromUTF8(title)));
newsTable->elementAt(i, 2)->addWidget(new WText(WString::fromUTF8(date)));
WSignalMapper<WPushButton *> *archiveSignalMapper = new WSignalMapper<WPushButton *>(this);
WSignalMapper<WPushButton *> *editSignalMapper = new WSignalMapper<WPushButton *>(this);
WSignalMapper<WPushButton *> *eraseSignalMapper = new WSignalMapper<WPushButton *>(this);
archiveSignalMapper->mapped().connect(this, &CmsNews::OnArchiveButtonPressed);
editSignalMapper->mapped().connect(this, &CmsNews::OnEditButtonPressed);
eraseSignalMapper->mapped().connect(this, &CmsNews::OnEraseButtonPressed);
wstring archiveText;
if (archived == "0") {
archiveText = m_lang->GetString("ROOT_CMSNEWS_ARCHIVED_TEXT");
} else {
archiveText = m_lang->GetString("ROOT_CMSNEWS_UNARCHIVE_TEXT");
}
WPushButton *archiveButton = new WPushButton(archiveText);
WPushButton *editButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_EDIT_TEXT"));
WPushButton *eraseButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_ERASE_TEXT"));
archiveSignalMapper->mapConnect(archiveButton->clicked(), archiveButton);
editSignalMapper->mapConnect(editButton->clicked(), editButton);
eraseSignalMapper->mapConnect(eraseButton->clicked(), eraseButton);
archiveButton->setStyleClass("tblButton");
editButton->setStyleClass("tblButton");
eraseButton->setStyleClass("tblButton");
archiveButton->setAttributeValue("dbid", boost::lexical_cast<wstring>(rowid));
editButton->setAttributeValue("dbid", boost::lexical_cast<wstring>(rowid));
eraseButton->setAttributeValue("dbid", boost::lexical_cast<wstring>(rowid));
newsTable->elementAt(i, 3)->addWidget(archiveButton);
newsTable->elementAt(i, 4)->addWidget(editButton);
newsTable->elementAt(i, 5)->addWidget(eraseButton);
}
}
Wt::WWidget *CmsNews::GetAddNewsForm()
{
Div *root = new Div("AddNewsForm");
Div *dvForm = new Div(root);
dvForm->setStyleClass("form");
WGridLayout *dvFormLayout = new WGridLayout();
m_titleLineEdit = new WLineEdit();
m_bodyTextArea = new WTextArea();
m_bodyTextArea->resize(WLength::Auto, 285);
dvFormLayout->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_TITLE_TEXT")),
0, 0, AlignLeft | AlignMiddle);
dvFormLayout->addWidget(m_titleLineEdit, 0, 1);
dvFormLayout->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_BODY_TEXT")),
1, 0, AlignLeft | AlignTop);
dvFormLayout->addWidget(m_bodyTextArea, 1, 1);
dvFormLayout->setColumnStretch(0, 50);
dvFormLayout->setColumnStretch(1, 450);
dvFormLayout->setVerticalSpacing(11);
dvForm->resize(500, WLength::Auto);
dvForm->setLayout(dvFormLayout);
Div *dvButtons = new Div(root, "dvDialogButtons");
WPushButton *addButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_ADD_DLG_ADD_BUTTON"), dvButtons);
WPushButton *returnButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_ADD_DLG_RETURN_BUTTON"), dvButtons);
addButton->setStyleClass("dialogButton");
returnButton->setStyleClass("dialogButton");
WLengthValidator *titleValidator = new WLengthValidator(Base::NEWS_MIN_TITLE_LEN, Base::NEWS_MAX_TITLE_LEN);
WLengthValidator *bodyValidator = new WLengthValidator(Base::NEWS_MIN_BODY_LEN, Base::NEWS_MAX_BODY_LEN);
titleValidator->setMandatory(true);
bodyValidator->setMandatory(true);
m_titleLineEdit->setValidator(titleValidator);
m_bodyTextArea->setValidator(bodyValidator);
m_titleLineEdit->setFocus();
m_titleLineEdit->enterPressed().connect(this, &CmsNews::OnAddDialogAddButtonPressed);
addButton->clicked().connect(this, &CmsNews::OnAddDialogAddButtonPressed);
returnButton->clicked().connect(this, &CmsNews::OnAddDialogReturnButtonPressed);
return root;
}
Wt::WWidget *CmsNews::GetEditNewsForm(string id)
{
Div *root = new Div("EditNewsForm");
Div *dvForm = new Div(root);
dvForm->setStyleClass("form");
WGridLayout *dvFormLayout = new WGridLayout();
m_titleLineEdit = new WLineEdit();
m_bodyTextArea = new WTextArea();
m_bodyTextArea->resize(WLength::Auto, 285);
result r = m_db->Sql() << "SELECT title, body FROM ["
+ m_dbTables->Table("NEWS")
+ "] WHERE rowid=?;" << id << row;
if (!r.empty()) {
string title;
string body;
r >> title >> body;
title = Crypto::Decrypt(title);
body = Crypto::Decrypt(body);
m_titleLineEdit->setText(WString::fromUTF8(title));
m_bodyTextArea->setText(WString::fromUTF8(body));
}
dvFormLayout->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_TITLE_TEXT")),
0, 0, AlignLeft | AlignMiddle);
dvFormLayout->addWidget(m_titleLineEdit, 0, 1);
dvFormLayout->addWidget(new WText(m_lang->GetString("ROOT_CMSNEWS_BODY_TEXT")),
1, 0, AlignLeft | AlignTop);
dvFormLayout->addWidget(m_bodyTextArea, 1, 1);
dvFormLayout->setColumnStretch(0, 50);
dvFormLayout->setColumnStretch(1, 450);
dvFormLayout->setVerticalSpacing(11);
dvForm->resize(500, WLength::Auto);
dvForm->setLayout(dvFormLayout);
Div *dvButtons = new Div(root, "dvDialogButtons");
WPushButton *editButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_EDIT_DLG_EDIT_BUTTON"), dvButtons);
WPushButton *returnButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_ADD_DLG_RETURN_BUTTON"), dvButtons);
editButton->setStyleClass("dialogButton");
returnButton->setStyleClass("dialogButton");
WLengthValidator *titleValidator = new WLengthValidator(Base::NEWS_MIN_TITLE_LEN, Base::NEWS_MAX_TITLE_LEN);
WLengthValidator *bodyValidator = new WLengthValidator(Base::NEWS_MIN_BODY_LEN, Base::NEWS_MAX_BODY_LEN);
titleValidator->setMandatory(true);
bodyValidator->setMandatory(true);
m_titleLineEdit->setValidator(titleValidator);
m_bodyTextArea->setValidator(bodyValidator);
m_titleLineEdit->setFocus();
m_titleLineEdit->enterPressed().connect(this, &CmsNews::OnEditDialogEditButtonPressed);
editButton->clicked().connect(this, &CmsNews::OnEditDialogEditButtonPressed);
returnButton->clicked().connect(this, &CmsNews::OnEditDialogReturnButtonPressed);
return root;
}
/**********************************
* = Base Class Overrides =
**********************************/
WWidget *CmsNews::Layout()
{
Div *root = new Div("CmsNews");
new WText(m_lang->GetString("ROOT_CMSNEWS_NEWS_MANAGEMENT_TITLE"), root);
Div *dvCNews = new Div(root, "dvCNews");
WPushButton *addButton = new WPushButton(m_lang->GetString("ROOT_CMSNEWS_ADD_BUTTON"),
dvCNews);
addButton->setStyleClass("formButton");
m_dvNewsTable = new Div(dvCNews, "dvNewsTable");
FillNewsDataTable();
addButton->clicked().connect(this, &CmsNews::OnAddButtonPressed);
return root;
}
/**********************************
* = Utility Methods =
**********************************/
/**********************************
* = Debug Methods =
**********************************/
| 32.725738
| 116
| 0.60985
|
NuLL3rr0r
|
63e3d7893ec12ec79418597a0ba5be7211de5f48
| 5,786
|
cpp
|
C++
|
test/matrix.cpp
|
Mooxmirror/tmath
|
aef1a6ce5a121987c3d943e0de9ec4a8aafe5054
|
[
"MIT"
] | 8
|
2016-03-29T04:37:57.000Z
|
2020-10-29T16:53:48.000Z
|
test/matrix.cpp
|
lnsp/tmath
|
aef1a6ce5a121987c3d943e0de9ec4a8aafe5054
|
[
"MIT"
] | 23
|
2016-04-06T14:50:04.000Z
|
2018-07-10T22:51:33.000Z
|
test/matrix.cpp
|
Mooxmirror/tmath
|
aef1a6ce5a121987c3d943e0de9ec4a8aafe5054
|
[
"MIT"
] | 1
|
2019-09-04T23:28:20.000Z
|
2019-09-04T23:28:20.000Z
|
/*
This test checks the matrix functionality.
*/
#include "tmath.hpp"
#include "tmath_test.hpp"
int main(int argc, char const *argv[]) {
using TMathTest::assert;
using TMathTest::assertTrue;
using TMathTest::assertError;
using TMath::DOUBLE;
using TMath::Matrix;
using TMath::Vector;
Matrix nullMatrix1(1, 1);
Matrix nullMatrix2{{0}};
Matrix oneMatrix{{1}};
Matrix identityMatrix{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
Matrix reverseMatrix{{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}};
Matrix valueMatrix{{2, 0, 0}, {0, 2, 0}, {0, 0, 2}};
Matrix nullMatrix3(3, 3);
Vector nullVector1{0};
Vector nullVector3{0, 0, 0};
Vector oneVector1{1};
Vector oneVector2{1, 0, 0};
Vector oneVector3{1, 1, 1};
Vector countVector{1, 2, 3};
// Check for constructor errors
assert(nullMatrix1, nullMatrix2, "{{0}} == Matrix(1, 1)");
assertTrue(!(nullMatrix1 != nullMatrix2), "!{{0}} != Matrix(1, 1)");
assertError([&](){ nullMatrix1 == identityMatrix; }, "Dimension mismatch by 1x1 == 3x3");
assertError([&](){ nullMatrix1 != identityMatrix; }, "Dimension mismatch by 1x1 == 3x3");
assertError([&](){ Matrix(0, 0); }, "Empty matrix constructor using dimensions");
assertError([&](){ Matrix{}; }, "Empty matrix constructor using initializer list");
// Check for copy constructor
assert(identityMatrix, Matrix(identityMatrix), "m == Matrix(m)");
assert(nullMatrix1, Matrix(nullMatrix2), "{{0}} == Matrix({{0}})");
// Check for access operator
assertTrue(nullMatrix1[0][0] == 0, "{{0}}[0][0] == 0");
assertTrue(identityMatrix[0][0] == 1, "Identity[0][0] == 1");
assertTrue(identityMatrix[1][0] == 0, "Identity[1][0] == 0");
assertTrue(identityMatrix[1][1] == 1, "Identity[1][1] == 1");
// Check for width and heiht
assert(nullMatrix1.colCount(), 1, "{{0}}.colCount() == 1");
assert(nullMatrix2.rowCount(), 1, "Matrix(1, 1).rowCount() == 1");
assert(identityMatrix.colCount(), 3, "Identity.colCount() == 3");
assert(identityMatrix.rowCount(), 3, "Identity.rowCount() == 3");
// Check for to_string
assertTrue(nullMatrix1.to_string() == "{[0]}", "str({{0}}) == '{[0]}'");
assertTrue(identityMatrix.to_string() == "{[1, 0, 0], [0, 1, 0], [0, 0, 1]}", "str(Identity) == '{[1, 0, 0], [0, 1, 0], [0, 0, 1]}'");
// Check for matrix + matrix
assertError([&](){ nullMatrix1 + identityMatrix; }, "Dimension mismatch by 1x1 + 3x3");
assert(nullMatrix1 + nullMatrix2, nullMatrix1, "{{0}} + Matrix(1, 1) == {{0}}");
assert(identityMatrix + identityMatrix, valueMatrix, "Identity + Identity = 2*Identity");
assert(reverseMatrix + identityMatrix, nullMatrix3, "Identity + (-Identity) = Matrix(3, 3)");
// Check for matrix - matrix
assertError([&](){ nullMatrix1 - identityMatrix; }, "Dimension mismatch by 1x1 - 3x3");
assert(nullMatrix1 - nullMatrix2, nullMatrix1, "{{0}} - Matrix(1, 1) == {{0}}");
assert(identityMatrix - identityMatrix, nullMatrix3, "Identity - Identity = Matrix(3, 3)");
assert(identityMatrix - reverseMatrix, valueMatrix, "Identity - (-Identity) = 2*Identity");
// Check for at
assertError([&](){ nullMatrix1.row(2); }, "Can not access index out of matrix Matrix(1, 1)[2]");
assertError([&](){ nullMatrix1.col(2); }, "Can not access index out of matrix Matrix(1, 1)[2]");
assertError([&](){ nullMatrix2.at(2, 2); }, "Can not access index out of matrix {{0}}[2, 2]");
assert(nullMatrix1.row(0), nullVector1, "Matrix(1, 1)[0] == Vector{0}");
assert(nullMatrix1.col(0), nullVector1, "Matrix(1, 1)[0] == Vector{0}");
assert(identityMatrix.row(0), oneVector2, "Identity[0] == Vector{1, 0, 0}");
assert(identityMatrix.col(0), oneVector2, "Identity[0] == Vector{1, 0, 0}");
assert(nullMatrix1.at(0, 0), 0, "Matrix(1, 1)[0, 0] == 0");
assert(identityMatrix.at(2, 2), 1, "Identity[2, 2] == 1");
// Check for matrix * vector
assertError([&](){ nullMatrix2 * oneVector2; }, "Can not multiply Matrix(1, 1) with Vector(3)");
assert(nullMatrix1 * oneVector1, nullVector1, "Matrix(1, 1) * Vector{1} == Vector{0}");
assert(nullMatrix1 * nullVector1, nullVector1, "Matrix(1, 1) * Vector{0} == Vector{0}");
assert(identityMatrix * countVector, countVector, "Identity * Vector{1, 2, 3} == Vector{1, 2, 3}");
assert(reverseMatrix * countVector, -countVector, "ReverseIdentity * Vector{1, 2, 3} == Vector{-1, -2, -3}");
// Check for matrix * matrix
assertError([&](){ identityMatrix * nullMatrix1; }, "Can not multiply Matrix(1, 1) with Matrix(3, 3)");
assertError([&](){ nullMatrix1 * identityMatrix; }, "Can not multiply Matrix(3, 3) with Matrix(1, 1)");
Matrix valueMatrix1{{3, 2, 1}, {1, 0, 2}};
Matrix valueMatrix2{{1, 2}, {0, 1}, {4, 0}};
Matrix valueMatrix3{{1, 2, 3}};
Matrix valueMatrix4{{1}, {2}, {3}};
Matrix resultMatrix1{{7, 8}, {9, 2}};
Matrix resultMatrix2{{14}};
assert(valueMatrix1 * valueMatrix2, resultMatrix1, "2x3 * 3x2 == 2x2");
assert(valueMatrix3 * valueMatrix4, resultMatrix2, "1x3 * 3x1 == 1x1");
assert(valueMatrix3 * identityMatrix, valueMatrix3, "1x3 * Identity == 1x3");
assert(identityMatrix * valueMatrix4, valueMatrix4, "Identity * 3x1 == 3x1");
// Check for matrix * scalar and -matrix
assert(identityMatrix * 2.0, valueMatrix, "Identity * 2 == {{2, 0, 0}, {0, 2, 0}, {0, 0, 2}}");
assert(nullMatrix1 * 0.0, nullMatrix1, "{{0}} * 0 == {{0}}");
assert(nullMatrix1 * 1.0, nullMatrix1, "{{0}} * 1 == {{0}}");
assert(identityMatrix * -1.0, reverseMatrix, "-Identity == Reverse");
assert(valueMatrix * 0.5, identityMatrix, "0.5 * {{2, 0, 0}, {0, 2, 0}, {0, 0, 2}} == Identity");
assert(-identityMatrix, reverseMatrix, "-Identity == Reverse");
assert(-nullMatrix1, nullMatrix1, "-{{0}} == {{0}}");
// Check for matrix identity
assert(identityMatrix, Matrix::identity(3), "Identity(3) = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}");
assert(oneMatrix, Matrix::identity(1), "Identity(1) = {{1}}");
return 0;
}
| 49.452991
| 135
| 0.642067
|
Mooxmirror
|
63e6b1608812a875408b5b3947f93ad1c8472bec
| 2,076
|
hpp
|
C++
|
include/Global/global.hpp
|
Lucrecious/DungeonGame
|
9e427c4eba18cdc0aa93a6e28e505a8ecb1357e5
|
[
"MIT"
] | null | null | null |
include/Global/global.hpp
|
Lucrecious/DungeonGame
|
9e427c4eba18cdc0aa93a6e28e505a8ecb1357e5
|
[
"MIT"
] | null | null | null |
include/Global/global.hpp
|
Lucrecious/DungeonGame
|
9e427c4eba18cdc0aa93a6e28e505a8ecb1357e5
|
[
"MIT"
] | null | null | null |
#ifndef GLOBALS_H
#define GLOBALS_H
#include <stdlib.h>
#include <vector>
#include <Global/kind.hpp>
#include <Global/information.hpp>
class Game;
class Player;
class Global {
public:
const static int levelHeight = 25;
const static int levelWidth = 79;
const static int maxChambers = 5;
const static int maxPotions = 10;
const static int maxGolds = 10;
const static int maxEnemies = 20;
const static int SmallGold = 1;
const static int NormalGold = 2;
const static int MerchantGold = 4;
const static int DragonGold = 6;
const static char VWallSymbol = '|';
const static char HWallSymbol = '-';
const static char FloorSymbol = '.';
const static char DoorSymbol = '+';
const static char PassageSymbol = '#';
const static char StairsSymbol = '\\';
const static char RHPotionSymbol = '0';
const static char BAPotionSymbol = '1';
const static char BDPotionSymbol = '2';
const static char PHPotionSymbol = '3';
const static char WAPotionSymbol = '4';
const static char WDPotionSymbol = '5';
const static char PotionSymbol = 'P';
const static char GoldNormalSymbol = '6';
const static char GoldSmallSymbol = '7';
const static char GoldMerchantSymbol = '8';
const static char GoldDragonSymbol = '9';
const static char GoldSymbol = 'G';
const static char PlayerSymbol = '@';
const static char HumanSymbol = 'H';
const static char DragonSymbol = 'D';
const static char DwarfSymbol = 'W';
const static char ElfSymbol = 'E';
const static char OrcSymbol = 'O';
const static char MerchantSymbol = 'M';
const static char HalflingSymbol = 'L';
const static char Chamber1Symbol = '0';
const static char Chamber2Symbol = '1';
const static char Chamber3Symbol = '2';
const static char Chamber4Symbol = '3';
const static char Chamber5Symbol = '4';
static bool hitChance(double);
static double drand(double, double);
static int irand(int, int);
static std::vector<Kind> constructProbabilityDist(Kind*, int*, int length);
static Kind getRandomKindFrom(std::vector<Kind>);
static Information makeInfoFromPlayer(Player*, Game*);
};
#endif
| 28.054054
| 76
| 0.72736
|
Lucrecious
|
63e70acd51eafd2e430847f7c35b5533faafd81d
| 6,003
|
cpp
|
C++
|
Raven.CppClient.Tests/BoundingBoxIndexTest.cpp
|
mlawsonca/ravendb-cpp-client
|
c3a3d4960c8b810156547f62fa7aeb14a121bf74
|
[
"MIT"
] | 3
|
2019-04-24T02:34:53.000Z
|
2019-08-01T08:22:26.000Z
|
Raven.CppClient.Tests/BoundingBoxIndexTest.cpp
|
mlawsonca/ravendb-cpp-client
|
c3a3d4960c8b810156547f62fa7aeb14a121bf74
|
[
"MIT"
] | 2
|
2019-03-21T09:00:02.000Z
|
2021-02-28T23:49:26.000Z
|
Raven.CppClient.Tests/BoundingBoxIndexTest.cpp
|
mlawsonca/ravendb-cpp-client
|
c3a3d4960c8b810156547f62fa7aeb14a121bf74
|
[
"MIT"
] | 3
|
2019-03-04T11:58:54.000Z
|
2021-03-01T00:25:49.000Z
|
#include "pch.h"
#include "RavenTestDriver.h"
#include "raven_test_definitions.h"
#include "DocumentSession.h"
#include "EntityIdHelperUtil.h"
#include "AbstractIndexCreationTask.h"
namespace bounding_box_index_test
{
struct SpatialDoc
{
std::string id{};
std::string shape{};
};
void from_json(const nlohmann::json& j, SpatialDoc& sd)
{
using ravendb::client::impl::utils::json_utils::get_val_from_json;
get_val_from_json(j, "shape", sd.shape);
}
void to_json(nlohmann::json& j, const SpatialDoc& sd)
{
using ravendb::client::impl::utils::json_utils::set_val_to_json;
set_val_to_json(j, "shape", sd.shape);
}
class BBoxIndex : public ravendb::client::documents::indexes::AbstractIndexCreationTask
{
public:
~BBoxIndex() override = default;
BBoxIndex()
{
SET_DEFAULT_INDEX_NAME();
map = R"(
docs.SpatialDocs.Select(doc => new {
shape = this.CreateSpatialField(doc.shape)
}))";
spatial("shape",
[](const ravendb::client::documents::indexes::spatial::SpatialOptionsFactory& options_factory)->
ravendb::client::documents::indexes::spatial::SpatialOptions
{
return options_factory.cartesian().bounding_box_index();
});
}
};
class QuadTreeIndex : public ravendb::client::documents::indexes::AbstractIndexCreationTask
{
public:
~QuadTreeIndex() override = default;
QuadTreeIndex()
{
SET_DEFAULT_INDEX_NAME();
map = R"(
docs.SpatialDocs.Select(doc => new {
shape = this.CreateSpatialField(doc.shape)
}))";
spatial("shape",
[](const ravendb::client::documents::indexes::spatial::SpatialOptionsFactory& options_factory)->
ravendb::client::documents::indexes::spatial::SpatialOptions
{
return options_factory.cartesian().quad_prefix_tree_index(6,
ravendb::client::documents::indexes::spatial::SpatialOptionsFactory::SpatialBounds(0, 0, 16, 16));
});
}
};
}
namespace ravendb::client::tests::spatial
{
class BoundingBoxIndexTest : public driver::RavenTestDriver
{
protected:
std::shared_ptr<documents::DocumentStore> store;
std::string rectangle1;
std::string rectangle2;
std::string rectangle3;
void customise_store(std::shared_ptr<documents::DocumentStore> store) override
{
//store->set_before_perform(infrastructure::set_for_fiddler);
}
static void SetUpTestCase()
{
REGISTER_ID_PROPERTY_FOR(bounding_box_index_test::SpatialDoc, id);
}
void SetUp() override {
std::string polygon = "POLYGON ((0 0, 0 5, 1 5, 1 1, 5 1, 5 5, 6 5, 6 0, 0 0))";
rectangle1 = "2 2 4 4";
rectangle2 = "6 6 10 10";
rectangle3 = "0 0 6 6";
store = get_document_store(TEST_NAME);
bounding_box_index_test::BBoxIndex().execute(store);
bounding_box_index_test::QuadTreeIndex().execute(store);
{
auto session = store->open_session();
auto doc = std::make_shared<bounding_box_index_test::SpatialDoc>();
doc->shape = polygon;
session.store(doc);
session.save_changes();
}
wait_for_indexing(store);
}
};
TEST_F(BoundingBoxIndexTest, SimpleQuery)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc>()->count();
ASSERT_EQ(1, result);
}
TEST_F(BoundingBoxIndexTest, IntersectTest_Rectangle1)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc, bounding_box_index_test::BBoxIndex>()
->spatial("shape",
[&](const documents::queries::spatial::SpatialCriteriaFactory& clause)->
std::unique_ptr<documents::queries::spatial::SpatialCriteria>
{
return clause.intersect(rectangle1);
})
->count();
ASSERT_EQ(1, result);
}
TEST_F(BoundingBoxIndexTest, IntersectTest_Rectangle2)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc, bounding_box_index_test::BBoxIndex>()
->spatial("shape",
[&](const documents::queries::spatial::SpatialCriteriaFactory& clause)->
std::unique_ptr<documents::queries::spatial::SpatialCriteria>
{
return clause.intersect(rectangle2);
})
->count();
ASSERT_EQ(0, result);
}
TEST_F(BoundingBoxIndexTest, DisjointTest_Rectangle1)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc, bounding_box_index_test::BBoxIndex>()
->spatial("shape",
[&](const documents::queries::spatial::SpatialCriteriaFactory& clause)->
std::unique_ptr<documents::queries::spatial::SpatialCriteria>
{
return clause.disjoint(rectangle1);
})
->count();
ASSERT_EQ(0, result);
}
TEST_F(BoundingBoxIndexTest, DisjointTest_Rectangle2)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc, bounding_box_index_test::BBoxIndex>()
->spatial("shape",
[&](const documents::queries::spatial::SpatialCriteriaFactory& clause)->
std::unique_ptr<documents::queries::spatial::SpatialCriteria>
{
return clause.disjoint(rectangle2);
})
->count();
ASSERT_EQ(1, result);
}
TEST_F(BoundingBoxIndexTest, WithinTest)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc, bounding_box_index_test::BBoxIndex>()
->spatial("shape",
[&](const documents::queries::spatial::SpatialCriteriaFactory& clause)->
std::unique_ptr<documents::queries::spatial::SpatialCriteria>
{
return clause.within(rectangle3);
})
->count();
ASSERT_EQ(1, result);
}
TEST_F(BoundingBoxIndexTest, IntersectTest_QuadTree)
{
auto session = store->open_session();
auto result = session.query<bounding_box_index_test::SpatialDoc, bounding_box_index_test::QuadTreeIndex>()
->spatial("shape",
[&](const documents::queries::spatial::SpatialCriteriaFactory& clause)->
std::unique_ptr<documents::queries::spatial::SpatialCriteria>
{
return clause.intersect(rectangle2);
})
->count();
ASSERT_EQ(0, result);
}
}
| 29.282927
| 109
| 0.707313
|
mlawsonca
|
63eb90e7e9eed6f79d78b493152dad272c67fdc9
| 7,330
|
hpp
|
C++
|
lab_control_center/src/commonroad_classes/TrafficSign.hpp
|
Durrrr95/cpm_lab
|
e2e6f4ace4ebc01e8ddd87e2f4acf13e6ffdcc67
|
[
"MIT"
] | 9
|
2020-06-24T11:22:15.000Z
|
2022-01-13T14:14:13.000Z
|
lab_control_center/src/commonroad_classes/TrafficSign.hpp
|
Durrrr95/cpm_lab
|
e2e6f4ace4ebc01e8ddd87e2f4acf13e6ffdcc67
|
[
"MIT"
] | 1
|
2021-05-10T13:48:04.000Z
|
2021-05-10T13:48:04.000Z
|
lab_control_center/src/commonroad_classes/TrafficSign.hpp
|
Durrrr95/cpm_lab
|
e2e6f4ace4ebc01e8ddd87e2f4acf13e6ffdcc67
|
[
"MIT"
] | 2
|
2021-11-08T11:59:29.000Z
|
2022-03-15T13:50:54.000Z
|
#pragma once
#include <libxml++-2.6/libxml++/libxml++.h>
#include <algorithm>
#include <functional>
#include <iterator>
#include <string>
#include <vector>
#include <optional>
//Optional is used for 3 reasons:
//1. Some values are optional according to the specification
//2. Some values might be missing if the file is not spec-conform, which is easy to handle when we do not require that they exist (though we still check for their existance)
//3. It is easier to set up an object piece by piece in the constructor, but that is not possible if the member object we want to set up does not have a default constructor (we would have to use the initializer list then)
#include "commonroad_classes/geometry/Position.hpp"
#include "commonroad_classes/InterfaceDraw.hpp"
#include "commonroad_classes/InterfaceTransform.hpp"
#include "commonroad_classes/XMLTranslation.hpp"
#include <sstream>
#include "commonroad_classes/SpecificationError.hpp"
#include "commonroad_classes/CommonroadDrawConfiguration.hpp"
#include "LCCErrorLogger.hpp"
#include <cassert> //To make sure that the translation is performed on the right node types, which should haven been made sure by the programming (thus not an error, but an assertion is used)
/**
* \struct TrafficSignElement
* \brief Specifies a part of traffic sign (a single sign)
* The commonroad XML file specifies specific string values for the sign ID, this restriction is not applied here (for simplicity)
* \ingroup lcc_commonroad
*/
struct TrafficSignElement
{
//! ID of the sign post, relating to the IDs defined in the commonroad specs e.g. for a speed limit sign
std::string traffic_sign_id;
//! Optional additional values, e.g. the speed limit
std::vector<std::string> additional_values;
};
/**
* \class TrafficSign
* \brief This class, like all other classes in this folder, are heavily inspired by the current (2020) common road XML specification (https://gitlab.lrz.de/tum-cps/commonroad-scenarios/blob/master/documentation/XML_commonRoad_2020a.pdf)
* It is used to store / represent a traffic sign specified in an XML file
* 2020 only! (Not specified in 2018 specs)
* \ingroup lcc_commonroad
*/
class TrafficSign : public InterfaceTransform, public InterfaceDraw
{
private:
//! List of traffic signs at the traffic sign's position
std::vector<TrafficSignElement> traffic_sign_elements;
//! Position of the traffic sign, which can be undefined - then, the position is given within some lanelet referencing to the traffic sign. Must be exact according to spec!
std::optional<Position> position = std::nullopt;
//! If the traffic sign(s) only exists virtually, not physically
std::vector<bool> is_virtual;
//! ID of the traffic sign
int id;
//Translation helper functions
//Helper functions for better readability
/**
* \brief Helper function to translate a Commonroad trafficSignElement
* \param element_node trafficSignElement node
*/
TrafficSignElement translate_traffic_sign_element(const xmlpp::Node* element_node);
/**
* \brief Helper function to translate an xml position node
* \param position_node The Commonroad XML position node
*/
Position translate_position(const xmlpp::Node* position_node);
/**
* \brief Helper function to translate an xml virtual node
* \param virtual_node The Commonroad XML active node
*/
bool translate_virtual(const xmlpp::Node* virtual_node);
//! Helper function from commonroadscenario to get position defined by lanelet if no position was defined for the traffic sign
std::function<std::optional<std::pair<double, double>>(int)> get_position_from_lanelet;
//! Look up current zoom factor for drawing text
std::shared_ptr<CommonroadDrawConfiguration> draw_configuration;
public:
/**
* \brief The constructor gets an XML node and parses it once, translating it to the C++ data structure
* An error is thrown in case the node is invalid / does not match the expected CommonRoad specs
* \param node A trafficSign node
* \param _get_position_from_lanelet A function that allows to obtain a position value defined for the sign by a lanelet reference, if it exists
* \param _draw_configuration A shared pointer pointing to the configuration for the scenario that sets which optional parts should be drawn
*/
TrafficSign(
const xmlpp::Node* node,
std::function<std::optional<std::pair<double, double>>(int)> _get_position_from_lanelet,
std::shared_ptr<CommonroadDrawConfiguration> _draw_configuration
);
/**
* \brief This function is used to fit the imported XML scenario to a given min. lane width
* The lane with min width gets assigned min. width by scaling the whole scenario up until it fits
* This scale value is used for the whole coordinate system
* \param scale The factor by which to transform all number values related to position, or the min lane width (for commonroadscenario) - 0 means: No transformation desired
* \param angle Rotation of the coordinate system, around the origin, w.r.t. right-handed coordinate system (according to commonroad specs), in radians
* \param translate_x Move the coordinate system's origin along the x axis by this value
* \param translate_y Move the coordinate system's origin along the y axis by this value
*/
void transform_coordinate_system(double scale, double angle, double translate_x, double translate_y) override;
/**
* \brief This function is used to draw the data structure that imports this interface
* If you want to set a color for drawing, perform this action on the context before using the draw function
* To change local translation, just transform the coordinate system beforehand
* As this does not always work with local orientation (where sometimes the translation in the object must be called before the rotation if performed, to rotate within the object's coordinate system),
* local_orientation was added as a parameter
* \param ctx A DrawingContext, used to draw on
* \param scale - optional: The factor by which to transform all number values related to position - this is not permanent, only for drawing (else, use InterfaceTransform's functions)
* \param global_orientation - optional: Rotation that needs to be applied before drawing - set as global transformation to the whole coordinate system
* \param global_translate_x - optional: Translation in x-direction that needs to be applied before drawing - set as global transformation to the whole coordinate system
* \param global_translate_y - optional: Translation in y-direction that needs to be applied before drawing - set as global transformation to the whole coordinate system
* \param local_orientation - optional: Rotation that needs to be applied within the object's coordinate system
*/
void draw(const DrawingContext& ctx, double scale = 1.0, double global_orientation = 0.0, double global_translate_x = 0.0, double global_translate_y = 0.0, double local_orientation = 0.0) override;
//Getter
/**
* \brief Get the stored list of traffic signs with the same ID
*/
const std::vector<TrafficSignElement>& get_traffic_sign_elements() const;
};
| 55.112782
| 237
| 0.751023
|
Durrrr95
|
63ee3efdeba152e2bad0aff3ae06fac0773d8d19
| 2,107
|
cpp
|
C++
|
test/DoubleLinkedListTest.cpp
|
FeniksFire/aisd
|
7e77a91b679ae129d16a4afeadb6fea09bf59af6
|
[
"MIT"
] | null | null | null |
test/DoubleLinkedListTest.cpp
|
FeniksFire/aisd
|
7e77a91b679ae129d16a4afeadb6fea09bf59af6
|
[
"MIT"
] | null | null | null |
test/DoubleLinkedListTest.cpp
|
FeniksFire/aisd
|
7e77a91b679ae129d16a4afeadb6fea09bf59af6
|
[
"MIT"
] | null | null | null |
#include "StdInc.h"
#include "DoubleLinkedList.h"
class DoubleLinkedListTest : public testing::Test
{
public:
DoubleLinkedList<int> list;
};
TEST_F(DoubleLinkedListTest, isFrontAndBackEqual)
{
list.insert(0, -3);
EXPECT_EQ(list.back()->getValue(), -3);
EXPECT_EQ(list.front()->getValue(), -3);
list.insert(3, 6);
EXPECT_EQ(list.get(1)->getValue(), 6);
EXPECT_EQ(list.get(1)->getPrev()->getValue(), -3);
}
TEST_F(DoubleLinkedListTest, previousElement)
{
list.insert(0, -3);
EXPECT_EQ(list.get(0)->getPrev(), nullptr);
list.insert(1, 6);
EXPECT_EQ(list.get(1)->getPrev()->getValue(), -3);
}
TEST_F(DoubleLinkedListTest, nextElement)
{
list.insert(0, -3);
EXPECT_EQ(list.get(0)->getNext(), nullptr);
list.insert(1, 6);
EXPECT_EQ(list.get(0)->getNext()->getValue(), 6);
}
TEST_F(DoubleLinkedListTest, insertInPlace)
{
list.insert(0, -3);
list.insert(1, 5);
list.insert(2, 0);
list.insert(0, 99);
EXPECT_EQ(list.get(1)->getValue(), 99);
}
TEST_F(DoubleLinkedListTest, replace)
{
list.insert(0, -3);
list.insert(1, 5);
list.insert(2, 0);
list.replace(1, 3);
list.replace(0, 15);
EXPECT_EQ(list.get(0)->getValue(), 15);
EXPECT_EQ(list.get(1)->getValue(), 3);
EXPECT_EQ(list.get(2)->getValue(), 0);
}
TEST_F(DoubleLinkedListTest, removeFrom) {
list.insert(0, -3);
list.insert(1, 0);
list.insert(2, 2);
list.insert(3, 5);
list.insert(4, 8);
list.remove(0);
list.remove(1);
list.remove(2);
EXPECT_EQ(list.front()->getValue(), 0);
EXPECT_EQ(list.back()->getValue(), 5);
EXPECT_EQ(list.size(), 2);
}
TEST_F(DoubleLinkedListTest, find) {
list.insert(0, -3);
list.insert(1, -44);
list.insert(2, 13);
list.insert(3, 14);
EXPECT_EQ(list.find(-44), 1);
EXPECT_EQ(list.find(13), 2);
EXPECT_EQ(list.find(14), 3);
}
TEST_F(DoubleLinkedListTest, findRemove) {
list.insert(0, -3);
list.insert(1, 0);
list.insert(2, 2);
list.insert(3, 5);
list.insert(4, 8);
list.removeFind(3);
list.removeFind(8);
list.removeFind(0);
list.removeFind(-3);
EXPECT_EQ(list.front()->getValue(), 2);
EXPECT_EQ(list.back()->getValue(), 5);
EXPECT_EQ(list.size(), 2);
}
| 20.259615
| 51
| 0.665401
|
FeniksFire
|
63ef71b74e29f52a8563a28b9fab5cd0df3f83b2
| 180
|
hpp
|
C++
|
src/object/scene/user.hpp
|
degarashi/revenant
|
9e671320a5c8790f6bdd1b14934f81c37819f7b3
|
[
"MIT"
] | null | null | null |
src/object/scene/user.hpp
|
degarashi/revenant
|
9e671320a5c8790f6bdd1b14934f81c37819f7b3
|
[
"MIT"
] | null | null | null |
src/object/scene/user.hpp
|
degarashi/revenant
|
9e671320a5c8790f6bdd1b14934f81c37819f7b3
|
[
"MIT"
] | null | null | null |
#pragma once
#include "scene.hpp"
namespace rev {
class U_Scene : public Scene<U_Scene> {
private:
struct St_None;
public:
U_Scene();
};
}
DEF_LUAIMPORT(rev::U_Scene)
| 13.846154
| 40
| 0.683333
|
degarashi
|
63f1c3faba5c50a46c7d60322a34de57e24dbe25
| 3,506
|
cpp
|
C++
|
experiments/inc/inc.cpp
|
enjalot/adventures_in_opencl
|
c222d15c076ee3f5f81b529eb47e87c8d8057096
|
[
"MIT"
] | 152
|
2015-01-04T00:58:08.000Z
|
2022-02-02T00:11:58.000Z
|
experiments/inc/inc.cpp
|
ahmadm-atallah/adventures_in_opencl
|
c222d15c076ee3f5f81b529eb47e87c8d8057096
|
[
"MIT"
] | 1
|
2017-09-21T13:36:15.000Z
|
2017-09-21T13:36:15.000Z
|
experiments/inc/inc.cpp
|
ahmadm-atallah/adventures_in_opencl
|
c222d15c076ee3f5f81b529eb47e87c8d8057096
|
[
"MIT"
] | 71
|
2015-02-11T17:12:09.000Z
|
2021-12-06T14:05:28.000Z
|
#include <stdio.h>
#include "cll.h"
#include "util.h"
void CL::popCorn()
{
printf("in popCorn\n");
std::string a_path(CL_SOURCE_DIR);
a_path += "/a.cl";
std::string b_path(CL_SOURCE_DIR);
b_path += "/b.cl";
a_program = loadProgram(a_path);
b_program = loadProgram(b_path);
//initialize our kernel from the program
try{
a_kernel = cl::Kernel(a_program, "a_kernel", &err);
b_kernel = cl::Kernel(b_program, "b_kernel", &err);
}
catch (cl::Error er) {
printf("ERROR: %s(%d)\n", er.what(), er.err());
}
//initialize our CPU memory arrays, send them to the device and set the kernel arguements
num = 10;
a.resize(num);
b.resize(num);
for(int i=0; i < num; i++)
{
a[i] = 1.0f * i;
b[i] = 1.0f * i;
}
params.c1 = 2.0f;
params.c2 = 3.0f;
printf("Creating OpenCL arrays\n");
size_t array_size = sizeof(float) * num;
//our input arrays
cl_a = cl::Buffer(context, CL_MEM_READ_ONLY, array_size, NULL, &err);
cl_b = cl::Buffer(context, CL_MEM_READ_ONLY, array_size, NULL, &err);
//our output array
cl_c_a = cl::Buffer(context, CL_MEM_WRITE_ONLY, array_size, NULL, &err);
cl_c_b = cl::Buffer(context, CL_MEM_WRITE_ONLY, array_size, NULL, &err);
cl_params = cl::Buffer(context, CL_MEM_READ_ONLY, sizeof(Params), NULL, &err);
printf("Pushing data to the GPU\n");
//push our CPU arrays to the GPU
//we can pass the address of the first element of our vector since it is a tightly packed array
err = queue.enqueueWriteBuffer(cl_a, CL_TRUE, 0, array_size, &a[0], NULL, &event);
err = queue.enqueueWriteBuffer(cl_b, CL_TRUE, 0, array_size, &b[0], NULL, &event);
//write the params struct to GPU memory as a buffer
err = queue.enqueueWriteBuffer(cl_params, CL_TRUE, 0, sizeof(Params), ¶ms, NULL, &event);
//set the arguements of our kernel
err = a_kernel.setArg(0, cl_a);
err = a_kernel.setArg(1, cl_b);
err = a_kernel.setArg(2, cl_c_a);
err = a_kernel.setArg(3, cl_params);
err = b_kernel.setArg(0, cl_a);
err = b_kernel.setArg(1, cl_b);
err = b_kernel.setArg(2, cl_c_b);
err = b_kernel.setArg(3, cl_params);
//Wait for the command queue to finish these commands before proceeding
queue.finish();
}
void CL::runKernel()
{
printf("in runKernel\n");
//execute the kernel
///err = clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL, workGroupSize, NULL, 0, NULL, &event);
err = queue.enqueueNDRangeKernel(a_kernel, cl::NullRange, cl::NDRange(num), cl::NullRange, NULL, &event);
err = queue.enqueueNDRangeKernel(b_kernel, cl::NullRange, cl::NDRange(num), cl::NullRange, NULL, &event);
///clReleaseEvent(event);
printf("clEnqueueNDRangeKernel: %s\n", oclErrorString(err));
///clFinish(command_queue);
queue.finish();
//lets check our calculations by reading from the device memory and printing out the results
float c_a_gpu[num];
float c_b_gpu[num];
err = queue.enqueueReadBuffer(cl_c_a, CL_TRUE, 0, sizeof(float) * num, &c_a_gpu, NULL, &event);
err = queue.enqueueReadBuffer(cl_c_b, CL_TRUE, 0, sizeof(float) * num, &c_b_gpu, NULL, &event);
printf("clEnqueueReadBuffer: %s\n", oclErrorString(err));
//clReleaseEvent(event);
for(int i=0; i < num; i++)
{
printf("c_a_gpu[%d] = %g \t c_b_gpu[%d] = %g\n",
i, c_a_gpu[i], i, i, c_b_gpu[i]);
}
}
| 31.585586
| 110
| 0.634912
|
enjalot
|
63f1f8438a3507d6cd9f35b45cc417fdd08d7952
| 4,164
|
cpp
|
C++
|
gpio.cpp
|
inspur-bmc/inspur-uuid
|
703633f2e81ba4d59eef74910c019e91d2bac63c
|
[
"Apache-2.0"
] | 2
|
2019-02-20T06:19:15.000Z
|
2021-09-15T08:24:09.000Z
|
gpio.cpp
|
inspur-bmc/inspur-uuid
|
703633f2e81ba4d59eef74910c019e91d2bac63c
|
[
"Apache-2.0"
] | null | null | null |
gpio.cpp
|
inspur-bmc/inspur-uuid
|
703633f2e81ba4d59eef74910c019e91d2bac63c
|
[
"Apache-2.0"
] | 1
|
2020-06-05T07:40:34.000Z
|
2020-06-05T07:40:34.000Z
|
#include "gpio.hpp"
#include "utility.hpp"
#include <iostream>
#include <thread>
namespace inspur
{
namespace identify
{
static constexpr auto consumer_label = "inspur-identify-led";
static constexpr auto PULS_TIME_MS = 100;
static constexpr auto BLINK_TIME_MS = 500;
GpioIdentify::GpioIdentify(EventPtr& event) : event(event)
{
gpioHandle = buildGpioHandle(0, utility::getHandleGpioOffset());
gpioEvent = buildGpioEvent(0, utility::getEventGpioOffset());
initTimer();
}
void GpioIdentify::initTimer()
{
sd_event_source* source = nullptr;
auto rc = sd_event_add_time(event.get(), &source, CLOCK_MONOTONIC,
UINT64_MAX, 0, timeoutHandler, this);
if (rc < 0)
{
std::cout << "sd_event_add_time error rc=" << rc << std::endl;
}
eventSource.reset(source);
}
std::unique_ptr<gpioplus::Handle> GpioIdentify::buildGpioHandle(uint32_t id,
uint32_t line)
{
try
{
gpioplus::Chip chip(id);
gpioplus::HandleFlags flags(chip.getLineInfo(line).flags);
flags.output = true;
std::vector<gpioplus::Handle::Line> lines = {{line, 0}};
return std::make_unique<gpioplus::Handle>(chip, lines, flags,
consumer_label);
}
catch (const std::exception& e)
{
std::cout << e.what() << std::endl;
return nullptr;
}
}
std::unique_ptr<gpioplus::Event> GpioIdentify::buildGpioEvent(uint32_t id,
uint32_t line)
{
try
{
gpioplus::Chip chip(id);
gpioplus::HandleFlags handleflags(chip.getLineInfo(line).flags);
handleflags.output = false;
gpioplus::EventFlags eventflags;
eventflags.falling_edge = true;
eventflags.rising_edge = true;
return std::make_unique<gpioplus::Event>(chip, line, handleflags,
eventflags, consumer_label);
}
catch (const std::exception& e)
{
std::cout << e.what() << std::endl;
return nullptr;
}
}
int GpioIdentify::getEventFd()
{
using namespace gpioplus::internal;
return *gpioEvent->getFd();
}
void GpioIdentify::cleanEventData()
{
gpioEvent->read();
}
int GpioIdentify::timeoutHandler(sd_event_source* source, uint64_t usec,
void* userdata)
{
auto gpioIdentify = static_cast<GpioIdentify*>(userdata);
gpioIdentify->toggleIdentifyLed();
gpioIdentify->setTimeout();
return 0;
}
void GpioIdentify::stopTimer()
{
auto rc = sd_event_source_set_enabled(eventSource.get(), SD_EVENT_OFF);
if (rc < 0)
{
std::cout << "sd_event_source_set_enabled error rc=" << rc << std::endl;
}
}
void GpioIdentify::startTimer()
{
setTimeout();
auto rc = sd_event_source_set_enabled(eventSource.get(), SD_EVENT_ON);
if (rc < 0)
{
std::cout << "sd_event_source_set_enabled error rc=" << rc << std::endl;
}
}
void GpioIdentify::setTimeout()
{
using namespace std::chrono;
auto now = steady_clock::now().time_since_epoch();
auto expireTime =
duration_cast<microseconds>(now) + milliseconds(BLINK_TIME_MS);
auto rc = sd_event_source_set_time(eventSource.get(), expireTime.count());
if (rc < 0)
{
std::cout << "sd_event_source_set_time error rc=" << rc << std::endl;
}
}
void GpioIdentify::setIdentifyLedState(IdentifyLedState state)
{
stopTimer();
auto current = getIdentifyLedState();
if (state == current)
return;
toggleIdentifyLed();
}
void GpioIdentify::toggleIdentifyLed()
{
uint8_t v = 0;
gpioHandle->setValues({v});
std::this_thread::sleep_for(std::chrono::milliseconds(PULS_TIME_MS));
v = 1;
gpioHandle->setValues({v});
}
void GpioIdentify::blinkIdentifyLed()
{
startTimer();
}
IdentifyLedState GpioIdentify::getIdentifyLedState()
{
if (gpioEvent->getValue() == 0)
return IdentifyLedState::Off;
return IdentifyLedState::On;
}
} // namespace identify
} // namespace inspur
| 25.084337
| 80
| 0.618396
|
inspur-bmc
|
63faa1d1a9302a340165d0e7d7705fb1581d5aea
| 1,673
|
cpp
|
C++
|
Core/Archive.cpp
|
newpolaris/Deferred
|
8db64c64599345032001786fb2c8d3727a1e4194
|
[
"MIT"
] | null | null | null |
Core/Archive.cpp
|
newpolaris/Deferred
|
8db64c64599345032001786fb2c8d3727a1e4194
|
[
"MIT"
] | 1
|
2017-06-29T12:45:12.000Z
|
2017-06-29T12:46:02.000Z
|
Core/Archive.cpp
|
newpolaris/Deferred
|
8db64c64599345032001786fb2c8d3727a1e4194
|
[
"MIT"
] | null | null | null |
#include "pch.h"
#include "Archive.h"
#include "FileUtility.h"
#include <mutex>
#include <sstream>
using namespace Utility;
namespace Utility
{
bool isZip( fs::path path )
{
std::ifstream inputFile;
bool bZip = false;
inputFile.open( path.generic_wstring(), std::ios::binary );
if (!inputFile.is_open())
return false;
int signature;
inputFile.read( reinterpret_cast<char*>(&signature), sizeof( signature ) );
inputFile.close();
if (signature == 0x04034b50 )
bZip = true;
return bZip;
}
}
fs::path RelativeFile::GetKeyName( fs::path name ) const
{
return m_Path / name;
}
bool RelativeFile::IsExist( fs::path name ) const
{
return boost::filesystem::exists( GetKeyName(name) );
}
Utility::ByteArray RelativeFile::GetFile( fs::path name )
{
return Utility::ReadFileSync( GetKeyName(name).generic_wstring() );
}
bool ZipArchive::IsExist( fs::path name ) const
{
return m_ZipReader.IsExist( GetKeyName(name).generic_string() );
}
//
// Returns path similar to zipname/name
// which can be use as GetFile argument
//
fs::path ZipArchive::GetKeyName( fs::path name ) const
{
// Patio contains "filename/" at front
fs::path root(m_PathList.front());
root += name;
return root;
}
Utility::ByteArray ZipArchive::GetFile( fs::path name )
{
static std::mutex s_ZipIterMutex;
// Patio use file stream as shared
lock_guard<mutex> CS( s_ZipIterMutex );
auto stream = std::unique_ptr<std::istream>( m_ZipReader.Get_File( GetKeyName(name).generic_string() ) );
std::ostringstream ss;
ss << stream->rdbuf();
const std::string& s = ss.str();
return std::make_shared<FileContainer>( s.begin(), s.end() );
}
| 22.608108
| 109
| 0.690377
|
newpolaris
|
63faa20ad82f51bce9760861ffa56ba9c192ce22
| 3,532
|
cpp
|
C++
|
day-12.cpp
|
MarioLiebisch/Advent-of-Code-2020
|
da8b2e8e86fa473818a690df2219d4f9c7abd9b6
|
[
"MIT"
] | null | null | null |
day-12.cpp
|
MarioLiebisch/Advent-of-Code-2020
|
da8b2e8e86fa473818a690df2219d4f9c7abd9b6
|
[
"MIT"
] | null | null | null |
day-12.cpp
|
MarioLiebisch/Advent-of-Code-2020
|
da8b2e8e86fa473818a690df2219d4f9c7abd9b6
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include "utility.h"
auto day12part1(const std::vector<aoc::NavInstruction>& instructions) -> std::size_t {
aoc::Position ship;
for (const auto& i : instructions) {
switch (i.type) {
case 'N':
ship.y -= i.value;
break;
case 'S':
ship.y += i.value;
break;
case 'E':
ship.x += i.value;
break;
case 'W':
ship.x -= i.value;
break;
case 'L':
ship.orientation = static_cast<aoc::Position::Orientation>(static_cast<unsigned char>(static_cast<int>(ship.orientation) - i.value / 90) % static_cast<int>(aoc::Position::Orientation::COUNT));
break;
case 'R':
ship.orientation = static_cast<aoc::Position::Orientation>(static_cast<unsigned char>(static_cast<int>(ship.orientation) + i.value / 90) % static_cast<int>(aoc::Position::Orientation::COUNT));
break;
case 'F':
switch (ship.orientation) {
case aoc::Position::Orientation::NORTH:
ship.y -= i.value;
break;
case aoc::Position::Orientation::SOUTH:
ship.y += i.value;
break;
case aoc::Position::Orientation::EAST:
ship.x += i.value;
break;
case aoc::Position::Orientation::WEST:
ship.x -= i.value;
break;
}
break;
}
}
return static_cast<std::size_t>(std::abs(ship.x)) + static_cast<std::size_t>(std::abs(ship.y));
}
auto day12part2(const std::vector<aoc::NavInstruction>& instructions) -> std::size_t {
aoc::Position ship, waypoint;
waypoint.x = 10;
waypoint.y = -1;
for (const auto& i : instructions) {
switch (i.type) {
case 'N':
waypoint.y -= i.value;
break;
case 'S':
waypoint.y += i.value;
break;
case 'E':
waypoint.x += i.value;
break;
case 'W':
waypoint.x -= i.value;
break;
case 'L':
for (int j = 0; j < i.value / 90; ++j) {
aoc::Position tmp = waypoint;
waypoint.x = tmp.y;
waypoint.y = -tmp.x;
}
break;
case 'R':
for (int j = 0; j < i.value / 90; ++j) {
aoc::Position tmp = waypoint;
waypoint.x = -tmp.y;
waypoint.y = tmp.x;
}
break;
case 'F':
ship.x += waypoint.x * i.value;
ship.y += waypoint.y * i.value;
break;
}
}
return static_cast<std::size_t>(std::abs(ship.x)) + static_cast<std::size_t>(std::abs(ship.y));
}
auto main(int argc, char** argv) -> int {
std::vector<aoc::NavInstruction> instructions;
aoc::readFromFile<aoc::NavInstruction>("day-12-sample.txt", std::back_inserter(instructions));
std::cout << "Sample 1 solution: " << day12part1(instructions) << "\n";
std::cout << "Sample 2 solution: " << day12part2(instructions) << "\n";
instructions.clear();
aoc::readFromFile<aoc::NavInstruction>("day-12-input.txt", std::back_inserter(instructions));
std::cout << "Part 1 solution: " << day12part1(instructions) << "\n";
std::cout << "Part 2 solution: " << day12part2(instructions) << "\n";
return 0;
}
| 33.320755
| 204
| 0.512458
|
MarioLiebisch
|
63fe4ed1239694add9ad46ab2488a68512b20701
| 1,200
|
cpp
|
C++
|
Sqrt.cpp
|
hgfeaon/leetcode
|
1e2a562bd8341fc57a02ecff042379989f3361ea
|
[
"BSD-3-Clause"
] | null | null | null |
Sqrt.cpp
|
hgfeaon/leetcode
|
1e2a562bd8341fc57a02ecff042379989f3361ea
|
[
"BSD-3-Clause"
] | null | null | null |
Sqrt.cpp
|
hgfeaon/leetcode
|
1e2a562bd8341fc57a02ecff042379989f3361ea
|
[
"BSD-3-Clause"
] | null | null | null |
#include <iostream>
#include <cstdlib>
using namespace std;
class Solution {
public:
int _sqrt(int x) {
int i = 0;
int m = 0;
while (i <= x) {
m = i * i;
if (m == x) {
break;
} else if (m > x) {
i--;
break;
} else {
i++;
}
}
return i;
}
int sqrt(int x) {
int lo = 0;
int hi = x;
int m = 0;
double mul = 0;
for (;;) {
times++;
m = (lo + hi) / 2;
if (lo > hi) break;
mul = 1.0 * m * m;
if (mul > x) {
hi = m - 1;
} else if (mul == x) {
break;
} else {
lo = m + 1;
}
}
return m;
}
int nsqrt(int x) {
if (x == 0) return 0;
double i = x;
int last;
for(;;) {
last = i;
i = i - i/2.0 + x/2.0/i;
if ((int)i == last) break;
}
return last;
}
};
int main() {
Solution s;
cout<<s.sqrt(2147395599)<<endl;
return 0;
}
| 19.047619
| 38
| 0.306667
|
hgfeaon
|
120134ae36d558e831b35dce1b078bb48bfde27f
| 1,895
|
hpp
|
C++
|
include/boost/mysql/impl/error.hpp
|
madmongo1/mysql-asio
|
26c57e92ddeebfee22e08e5ea05e7bb51248eba5
|
[
"BSL-1.0"
] | 1
|
2020-03-31T11:48:12.000Z
|
2020-03-31T11:48:12.000Z
|
include/boost/mysql/impl/error.hpp
|
madmongo1/mysql-asio
|
26c57e92ddeebfee22e08e5ea05e7bb51248eba5
|
[
"BSL-1.0"
] | null | null | null |
include/boost/mysql/impl/error.hpp
|
madmongo1/mysql-asio
|
26c57e92ddeebfee22e08e5ea05e7bb51248eba5
|
[
"BSL-1.0"
] | null | null | null |
#ifndef MYSQL_ASIO_IMPL_ERROR_HPP
#define MYSQL_ASIO_IMPL_ERROR_HPP
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
namespace boost {
namespace system {
template <>
struct is_error_code_enum<mysql::errc>
{
static constexpr bool value = true;
};
} // system
namespace mysql {
namespace detail {
inline const char* error_to_string(errc error) noexcept
{
switch (error)
{
case errc::ok: return "no error";
case errc::incomplete_message: return "The message read was incomplete (not enough bytes to fully decode it)";
case errc::extra_bytes: return "Extra bytes at the end of the message";
case errc::sequence_number_mismatch: return "Mismatched sequence numbers";
case errc::server_unsupported: return "The server does not implement the minimum features to be supported";
case errc::protocol_value_error: return "A field in a message had an unexpected value";
case errc::unknown_auth_plugin: return "The user employs an authentication plugin unknown to the client";
case errc::wrong_num_params: return "The provided parameter count does not match the prepared statement parameter count";
#include "boost/mysql/impl/server_error_descriptions.hpp"
default: return "<unknown error>";
}
}
class mysql_error_category_t : public boost::system::error_category
{
public:
const char* name() const noexcept final override { return "mysql"; }
std::string message(int ev) const final override
{
return error_to_string(static_cast<errc>(ev));
}
};
inline mysql_error_category_t mysql_error_category;
inline boost::system::error_code make_error_code(errc error)
{
return boost::system::error_code(static_cast<int>(error), mysql_error_category);
}
inline void check_error_code(const error_code& code, const error_info& info)
{
if (code)
{
throw boost::system::system_error(code, info.message());
}
}
} // detail
} // mysql
} // boost
#endif
| 27.071429
| 122
| 0.768338
|
madmongo1
|
1205ae6f0218d25459acbeb36ba606b4780dea25
| 19,010
|
cc
|
C++
|
dylocxx/src/topology.cc
|
fuchsto/dyloc
|
87a5a203406d09b0fb446a4bb3237ce34100651a
|
[
"BSD-3-Clause"
] | 4
|
2017-05-16T11:50:05.000Z
|
2020-08-12T16:47:28.000Z
|
dylocxx/src/topology.cc
|
fuchsto/dyloc
|
87a5a203406d09b0fb446a4bb3237ce34100651a
|
[
"BSD-3-Clause"
] | null | null | null |
dylocxx/src/topology.cc
|
fuchsto/dyloc
|
87a5a203406d09b0fb446a4bb3237ce34100651a
|
[
"BSD-3-Clause"
] | 3
|
2017-04-27T02:01:44.000Z
|
2018-11-27T11:21:57.000Z
|
#include <dylocxx/topology.h>
#include <dylocxx/utility.h>
#include <dylocxx/hwinfo.h>
#include <dylocxx/internal/logging.h>
#include <dylocxx/internal/assert.h>
#include <boost/graph/connected_components.hpp>
#include <boost/graph/edge_list.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/vector_as_graph.hpp>
#include <boost/graph/topological_sort.hpp>
#include <unordered_map>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <iostream>
#include <sstream>
namespace dyloc {
std::ostream & operator<<(
std::ostream & os,
const topology & topo) {
dyloc__unused(topo);
std::ostringstream ss;
ss << "dyloc::topology { ";
ss << " }";
return operator<<(os, ss.str());
}
std::ostream & operator<<(
std::ostream & os,
topology::vertex_state state) {
std::ostringstream ss;
switch (state) {
case topology::vertex_state::unspecified: ss << "U"; break;
case topology::vertex_state::hidden: ss << "H"; break;
case topology::vertex_state::moved: ss << "M"; break;
case topology::vertex_state::selected: ss << "S"; break;
}
return operator<<(os, ss.str());
}
void topology::rename_domain(
const std::string & old_tag,
const std::string & new_tag) {
if (old_tag == new_tag) { return; }
DYLOC_LOG_TRACE("dylocxx::topology.rename_domain",
"old tag:", old_tag, "new tag:", new_tag);
auto domain_it = _domains.find(old_tag);
if (domain_it != _domains.end()) {
domain_it->second.domain_tag = new_tag;
std::swap(_domains[new_tag], domain_it->second);
_domains.erase(domain_it);
}
auto domain_vx_it = _domain_vertices.find(old_tag);
if (domain_vx_it != _domain_vertices.end()) {
_graph[domain_vx_it->second].domain_tag = new_tag;
_domain_vertices[new_tag] = domain_vx_it->second;
_domain_vertices.erase(domain_vx_it);
}
const auto & dom = _domains[new_tag];
if (dom.scope == DYLOC_LOCALITY_SCOPE_UNIT) {
if (dom.unit_ids.size() != 1) {
DYLOC_THROW(
dyloc::exception::invalid_argument,
"expected exactly 1 unit in domain");
}
}
}
void topology::update_domain_attributes(const std::string & parent_tag) {
// Update domain tags, recursing down from specified domain.
// Could also be implemented using boost::depth_first_search.
auto parent_vx_it = _domain_vertices.find(parent_tag);
if (parent_vx_it == _domain_vertices.end()) {
DYLOC_LOG_TRACE("dylocxx::topology.update_domain_attributes",
"no vertex found for domain", parent_tag);
return;
}
typedef boost::graph_traits<graph_t>::out_edge_iterator::reference
out_edge_ref;
auto & domain_vx = parent_vx_it->second;
int rel_index = 0;
auto domain_edges = out_edges(domain_vx, _graph);
std::for_each(
domain_edges.first,
domain_edges.second,
[&](out_edge_ref parent_domain_edge) {
auto sub_domain_vx = target(parent_domain_edge, _graph);
const auto & sub_domain_old_tag = _graph[sub_domain_vx].domain_tag;
std::ostringstream ss;
if (parent_tag != ".") {
ss << parent_tag;
}
ss << "." << rel_index;
rename_domain(sub_domain_old_tag, ss.str());
update_domain_attributes(ss.str());
++rel_index;
});
}
void topology::update_domain_capacities(const std::string & domain_tag) {
// Accumulate domain capacities
auto parent_vx_it = _domain_vertices.find(domain_tag);
if (parent_vx_it == _domain_vertices.end()) {
return;
}
typedef boost::graph_traits<graph_t>::out_edge_iterator::reference
out_edge_ref;
auto & domain = _domains[domain_tag];
if (domain.scope != DYLOC_LOCALITY_SCOPE_UNIT) {
domain.unit_ids.clear();
domain.num_cores = 0;
auto & domain_vx = parent_vx_it->second;
auto domain_edges = out_edges(domain_vx, _graph);
auto num_subdomains = std::distance(domain_edges.first,
domain_edges.second);
std::for_each(
domain_edges.first,
domain_edges.second,
[&](out_edge_ref domain_edge) {
auto sub_domain_vx = target(domain_edge, _graph);
const auto & sub_domain_tag = _graph[sub_domain_vx].domain_tag;
auto & sub_domain = _domains[sub_domain_tag];
// depth-first recurse:
update_domain_capacities(sub_domain_tag);
// accumulate:
domain.unit_ids.insert(domain.unit_ids.begin(),
sub_domain.unit_ids.begin(),
sub_domain.unit_ids.end());
domain.num_cores += sub_domain.num_cores;
});
std::sort(domain.unit_ids.begin(),
domain.unit_ids.end(),
[](dart_global_unit_t a,
dart_global_unit_t b) { return a.id < b.id; });
}
}
void topology::relink_to_parent(
const std::string & domain_tag,
const std::string & domain_tag_new_parent) {
std::string domain_tag_old_parent = domain_tag;
auto sep_pos = domain_tag_old_parent.find_last_of(".");
if (sep_pos == std::string::npos) {
DYLOC_LOG_ERROR("dylocxx::topology.relink_to_parent",
"could not move", domain_tag,
"to", domain_tag_new_parent);
return;
}
domain_tag_old_parent.resize(sep_pos);
DYLOC_LOG_DEBUG("dylocxx::topology.relink_to_parent",
"move domain", _domains[domain_tag],
"from", domain_tag_old_parent,
"to", domain_tag_new_parent);
// Remove edge from current parent to domain:
boost::remove_edge(
_domain_vertices[domain_tag_old_parent],
_domain_vertices[domain_tag],
_graph);
// Add edge from new parent to domain:
boost::add_edge(
_domain_vertices[domain_tag_new_parent],
_domain_vertices[domain_tag],
{ edge_type::contains, _domains[domain_tag].level },
_graph);
}
void topology::move_domain(
const std::string & domain_tag,
const std::string & domain_tag_new_parent) {
relink_to_parent(domain_tag, domain_tag_new_parent);
update_domain_attributes(
ancestor({ domain_tag, domain_tag_new_parent }).domain_tag);
}
std::vector<std::string>
topology::scope_domain_tags(
dyloc_locality_scope_t scope) const {
std::vector<graph_vertex_t> vx_matches;
const auto vx_range = vertices(_graph);
std::for_each(
vx_range.first, vx_range.second,
[&](const graph_vertex_t & vx) {
if (_domains.at(_graph[vx].domain_tag).scope == scope) {
vx_matches.push_back(vx);
}
});
DYLOC_LOG_DEBUG("dylocxx::topology.scope_domain_tags",
"num. domains matched:", vx_matches.size());
std::vector<std::string> scope_dom_tags(vx_matches.size());
std::transform(
vx_matches.begin(),
vx_matches.end(),
scope_dom_tags.begin(),
[&](const graph_vertex_t & vx) {
return _graph[vx].domain_tag;
});
return scope_dom_tags;
}
void topology::build_hierarchy(
dart_team_t team,
const host_topology & host_topo) {
DYLOC_LOG_DEBUG("dylocxx::topology.build_hierarchy", "()");
locality_domain root_domain(team);
root_domain.scope = DYLOC_LOCALITY_SCOPE_GLOBAL;
root_domain.level = 0;
root_domain.g_index = 0;
root_domain.r_index = 0;
root_domain.num_cores = 0;
_domains.insert(std::make_pair(".", root_domain));
auto root_domain_vertex
= boost::add_vertex(
{ ".", vertex_state::unspecified },
_graph);
_domain_vertices[root_domain.domain_tag] = root_domain_vertex;
int node_index = 0;
for (auto & node_host_domain : host_topo.nodes()) {
const auto & node_hostname = node_host_domain.first;
DYLOC_LOG_DEBUG("dylocxx::topology.build_hierarchy",
"node host:", node_hostname);
locality_domain node_domain(
root_domain,
DYLOC_LOCALITY_SCOPE_NODE,
node_index);
++node_index;
node_domain.host = node_hostname;
node_domain.unit_ids = host_topo.unit_ids(node_hostname);
node_domain.num_cores = host_topo.nodes().at(node_domain.host)
.get().num_cores;
DYLOC_LOG_DEBUG("dylocxx::topology.build_hierarchy",
"add domain:", node_domain,
"num. cores:", node_domain.num_cores);
_domains.insert(
std::make_pair(
node_domain.domain_tag,
node_domain));
auto node_domain_vertex
= boost::add_vertex(
{ node_domain.domain_tag,
vertex_state::unspecified },
_graph);
_domain_vertices[node_domain.domain_tag] = node_domain_vertex;
boost::add_edge(root_domain_vertex, node_domain_vertex,
{ edge_type::contains, node_domain.level },
_graph);
build_node_level(
host_topo,
_domains[node_domain.domain_tag],
node_domain_vertex);
_domains[root_domain.domain_tag].num_cores +=
_domains[node_domain.domain_tag].num_cores;
}
}
void topology::build_node_level(
const host_topology & host_topo,
locality_domain & node_domain,
graph_vertex_t & node_domain_vertex) {
DYLOC_LOG_DEBUG("dylocxx::topology.build_node_level",
"node:", node_domain.host);
// modules located at node:
auto & node_modules = host_topo.node_modules(node_domain.host);
build_module_level(
host_topo,
node_domain,
node_domain_vertex,
0);
for (auto & node_module : node_modules) {
const auto & module_hostname = node_module.get().host;
auto node_domain_arity = out_degree(node_domain_vertex, _graph);
DYLOC_LOG_DEBUG("dylocxx::topology.build_node_level",
"node domain arity:", node_domain_arity,
"module host name:", module_hostname);
locality_domain module_domain(
node_domain,
DYLOC_LOCALITY_SCOPE_MODULE,
node_domain_arity);
module_domain.unit_ids = host_topo.unit_ids(module_hostname);
module_domain.host = module_hostname;
module_domain.num_cores = node_module.get().num_cores /
node_modules.size();
DYLOC_LOG_DEBUG("dylocxx::topology.build_node_level",
"add domain:", module_domain);
_domains.insert(
std::make_pair(
module_domain.domain_tag,
module_domain));
auto module_domain_vertex
= boost::add_vertex(
{ module_domain.domain_tag,
vertex_state::unspecified },
_graph);
_domain_vertices[module_domain.domain_tag] = module_domain_vertex;
boost::add_edge(node_domain_vertex, module_domain_vertex,
{ edge_type::contains, module_domain.level },
_graph);
build_module_level(
host_topo,
_domains[module_domain.domain_tag],
module_domain_vertex,
0);
}
}
void topology::build_module_level(
const host_topology & host_topo,
locality_domain & module_domain,
graph_vertex_t & module_domain_vertex,
int module_scope_level) {
/*
* NOTE: Locality scopes may be heterogeneous but are expected
* to be homogeneous within a module domain.
* For example, this would be a valid use case:
*
* module[0] { unit[0]: [CORE,CACHE,PACKAGE,NUMA],
* unit[1]: [CORE,CACHE,PACKAGE,NUMA] }
* module[1] { unit[2]: [CORE,CACHE,CACHE,CACHE,NUMA],
* unit[2]: [CORE,CACHE,CACHE,CACHE,NUMA] }
*/
/* Collect scope lists of all units at the given module, converting:
*
* u[0].scopes: [CORE:0, CACHE:4, CACHE:0, NUMA:0]
* u[1].scopes: [CORE:1, CACHE:5, CACHE:0, NUMA:0]
* u[2].scopes: [CORE:2, CACHE:6, CACHE:1, NUMA:0]
* u[3].scopes: [CORE:3, CACHE:7, CACHE:1, NUMA:0]
*
* to transposed structure:
*
* level[0]: { scope:NUMA, gids: [ 0 ],
* sub_gids:[[ 0 , 1 ]] }
*
* level[1]: { scope:CACHE, gids: [ 0, 1 ],
* sub_gids:[[4 , 5],[6 , 7]] }
*
* level[2]: { scope:CACHE, gids: [ 4, 5, 6, 7 ],
* sub_gids:[[0],[1],[2],[3]] }
*
* such that subdomains of a domain with global index G are referenced
* in sub_gids[G].
*/
dart_team_unit_t module_leader_unit_id;
DYLOC_ASSERT_RETURNS(
dart_team_unit_g2l(module_domain.team, module_domain.unit_ids[0],
&module_leader_unit_id),
DART_OK);
const auto & module_leader_unit_loc =
*((*_unit_mapping)[module_leader_unit_id].data());
const auto & module_leader_hwinfo = module_leader_unit_loc.hwinfo;
int num_scopes = module_leader_hwinfo.num_scopes;
std::vector<dyloc_locality_scope_t> module_scopes;
module_scopes.reserve(num_scopes);
for (int s = 0; s < num_scopes; s++) {
module_scopes.push_back(
module_leader_hwinfo.scopes[s].scope);
}
int subdomain_gid_idx = num_scopes - (module_scope_level + 1);
DYLOC_LOG_TRACE(
"dylocxx::topology.build_module_level", "--",
"current scope:", module_scopes[subdomain_gid_idx],
"level", subdomain_gid_idx,
"in module scopes:",
dyloc::make_range(
module_scopes.begin(),
module_scopes.end()));
DYLOC_LOG_TRACE(
"dylocxx::topology.build_module_level", "--",
"module units:",
dyloc::make_range(
module_domain.unit_ids.begin(),
module_domain.unit_ids.end()));
// Array of the global indices of the current module subdomains.
// Maximum number of global indices, including duplicates, is number
// of units:
//
std::vector<int> module_subdomain_gids;
module_subdomain_gids.reserve(module_domain.unit_ids.size());
for (auto module_unit_gid : module_domain.unit_ids) {
dart_team_unit_t module_unit_lid
= dyloc::g2l(module_domain.team, module_unit_gid);
const auto & module_unit_loc =
*((*_unit_mapping)[module_unit_lid].data());
const auto & module_unit_hwinfo = module_unit_loc.hwinfo;
int unit_level_gid = module_unit_hwinfo.scopes[subdomain_gid_idx+1].index;
int unit_sub_gid = -1;
if (subdomain_gid_idx >= 0) {
unit_sub_gid = module_unit_hwinfo.scopes[subdomain_gid_idx].index;
}
// Ignore units that are not contained in current module domain:
if (module_scope_level == 0 ||
unit_level_gid == module_domain.g_index) {
module_subdomain_gids.push_back(unit_sub_gid);
}
}
std::sort(module_subdomain_gids.begin(),
module_subdomain_gids.end());
auto module_subdomain_gids_end = std::unique(
module_subdomain_gids.begin(),
module_subdomain_gids.end());
auto num_subdomains = std::distance(
module_subdomain_gids.begin(),
module_subdomain_gids_end);
DYLOC_LOG_TRACE(
"dylocxx::topology.build_module_level", "--",
"module subdomain gids:",
dyloc::make_range(
module_subdomain_gids.begin(),
module_subdomain_gids_end));
for (int sd = 0; sd < num_subdomains; ++sd) {
locality_domain module_subdomain(
module_domain,
module_scopes[subdomain_gid_idx],
sd);
module_subdomain.host = module_domain.host;
module_subdomain.g_index = module_subdomain_gids[sd];
module_subdomain.num_cores = module_domain.num_cores / num_subdomains;
for (auto module_unit_gid : module_domain.unit_ids) {
dart_team_unit_t module_unit_lid
= dyloc::g2l(module_domain.team, module_unit_gid);
const auto & module_unit_loc =
*((*_unit_mapping)[module_unit_lid].data());
const auto & module_unit_hwinfo = module_unit_loc.hwinfo;
if (module_unit_hwinfo.scopes[subdomain_gid_idx].index ==
module_subdomain.g_index) {
module_subdomain.unit_ids.push_back(module_unit_gid);
}
}
DYLOC_LOG_DEBUG("dylocxx::topology.build_node_level", "--",
"add domain:", module_subdomain);
_domains.insert(
std::make_pair(
module_subdomain.domain_tag,
module_subdomain));
auto module_subdomain_vertex
= boost::add_vertex(
{ module_subdomain.domain_tag,
vertex_state::unspecified },
_graph);
_domain_vertices[module_subdomain.domain_tag] = module_subdomain_vertex;
boost::add_edge(module_domain_vertex, module_subdomain_vertex,
{ edge_type::contains, module_domain.level },
_graph);
if (subdomain_gid_idx <= 0) {
DYLOC_LOG_DEBUG("dylocxx::topology.build_node_level", "--",
"mapped units:",
dyloc::make_range(
module_subdomain.unit_ids.begin(),
module_subdomain.unit_ids.end()));
// At unit scope, module subdomain is CORE: add domain for every unit:
for (size_t ud = 0; ud < module_subdomain.unit_ids.size(); ++ud) {
auto unit_gid = module_subdomain.unit_ids[ud];
locality_domain unit_domain(
module_subdomain,
DYLOC_LOCALITY_SCOPE_UNIT,
ud);
unit_domain.host = module_domain.host;
unit_domain.g_index = unit_gid.id;
unit_domain.unit_ids.push_back(unit_gid);
unit_domain.num_cores = module_subdomain.num_cores /
module_subdomain.unit_ids.size();
// Update unit mapping, set domain tag of unit locality:
// auto unit_lid = dyloc::g2l(module_subdomain.team, unit_gid);
// std::strcpy((*(*_unit_mapping)[unit_lid].data()).domain_tag,
// unit_domain.domain_tag.c_str());
_domains[unit_domain.domain_tag] = unit_domain;
auto unit_domain_vertex
= boost::add_vertex(
{ unit_domain.domain_tag,
vertex_state::unspecified },
_graph);
_domain_vertices[unit_domain.domain_tag] = unit_domain_vertex;
_unit_vertices[unit_gid.id] = unit_domain_vertex;
boost::add_edge(module_subdomain_vertex, unit_domain_vertex,
{ edge_type::contains, unit_domain.level },
_graph);
}
} else {
// Recurse down:
build_module_level(
host_topo,
_domains[module_subdomain.domain_tag],
module_subdomain_vertex,
module_scope_level + 1);
}
}
}
int topology::subdomain_distance(
const std::string & parent_tag,
const std::string & child_tag) {
return ( _domains[child_tag].level *
( _domains[child_tag].level -
_domains[parent_tag].level ) );
}
} // namespace dyloc
| 33.646018
| 78
| 0.633877
|
fuchsto
|
120f2c3dfd11cb6196f3bf76e1458ee7d078f6ab
| 10,370
|
cpp
|
C++
|
soundlib/Load_mus_km.cpp
|
sitomani/openmpt
|
913396209c22a1fc6dfb29f0e34893dfb0ffa591
|
[
"BSD-3-Clause"
] | null | null | null |
soundlib/Load_mus_km.cpp
|
sitomani/openmpt
|
913396209c22a1fc6dfb29f0e34893dfb0ffa591
|
[
"BSD-3-Clause"
] | null | null | null |
soundlib/Load_mus_km.cpp
|
sitomani/openmpt
|
913396209c22a1fc6dfb29f0e34893dfb0ffa591
|
[
"BSD-3-Clause"
] | null | null | null |
/*
* Load_mus_km.cpp
* ---------------
* Purpose: Karl Morton Music Format module loader
* Notes : This is probably not the official name of this format.
* Karl Morton's engine has been used in Psycho Pinball and Micro Machines 2 and also Back To Baghdad
* but the latter game only uses its sound effect format, not the music format.
* So there are only two known games using this music format, and no official tools or documentation are available.
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#include "stdafx.h"
#include "Loaders.h"
#include "ChunkReader.h"
OPENMPT_NAMESPACE_BEGIN
struct KMChunkHeader
{
// 32-Bit chunk identifiers
enum ChunkIdentifiers
{
idSONG = MagicLE("SONG"),
idSMPL = MagicLE("SMPL"),
};
uint32le id; // See ChunkIdentifiers
uint32le length; // Chunk size including header
size_t GetLength() const
{
return length <= 8 ? 0 : (length - 8);
}
ChunkIdentifiers GetID() const
{
return static_cast<ChunkIdentifiers>(id.get());
}
};
MPT_BINARY_STRUCT(KMChunkHeader, 8)
struct KMSampleHeader
{
char name[32];
uint32le loopStart;
uint32le size;
};
MPT_BINARY_STRUCT(KMSampleHeader, 40)
struct KMSampleReference
{
char name[32];
uint8 finetune;
uint8 volume;
};
MPT_BINARY_STRUCT(KMSampleReference, 34)
struct KMSongHeader
{
char name[32];
KMSampleReference samples[31];
uint16le unknown; // always 0
uint32le numChannels;
uint32le restartPos;
uint32le musicSize;
};
MPT_BINARY_STRUCT(KMSongHeader, 32 + 31 * 34 + 14)
struct KMFileHeader
{
KMChunkHeader chunkHeader;
KMSongHeader songHeader;
};
MPT_BINARY_STRUCT(KMFileHeader, sizeof(KMChunkHeader) + sizeof(KMSongHeader))
static uint64 GetHeaderMinimumAdditionalSize(const KMFileHeader &fileHeader)
{
// Require room for at least one more sample chunk header
return static_cast<uint64>(fileHeader.songHeader.musicSize) + sizeof(KMChunkHeader);
}
// Check if string only contains printable characters and doesn't contain any garbage after the required terminating null
static bool IsValidKMString(const char (&str)[32])
{
bool nullFound = false;
for(char c : str)
{
if(c > 0x00 && c < 0x20)
return false;
else if(c == 0x00)
nullFound = true;
else if(nullFound)
return false;
}
return nullFound;
}
static bool ValidateHeader(const KMFileHeader &fileHeader)
{
if(fileHeader.chunkHeader.id != KMChunkHeader::idSONG
|| fileHeader.chunkHeader.length < sizeof(fileHeader)
|| fileHeader.chunkHeader.length - sizeof(fileHeader) != fileHeader.songHeader.musicSize
|| fileHeader.chunkHeader.length > 0x40000 // That's enough space for 256 crammed 64-row patterns ;)
|| fileHeader.songHeader.unknown != 0
|| fileHeader.songHeader.numChannels < 1
|| fileHeader.songHeader.numChannels > 4 // Engine rejects anything above 32, channels 5 to 32 are simply ignored
|| !IsValidKMString(fileHeader.songHeader.name))
{
return false;
}
for(const auto &sample : fileHeader.songHeader.samples)
{
if(sample.finetune > 15 || sample.volume > 64 || !IsValidKMString(sample.name))
return false;
}
return true;
}
CSoundFile::ProbeResult CSoundFile::ProbeFileHeaderMUS_KM(MemoryFileReader file, const uint64 *pfilesize)
{
KMFileHeader fileHeader;
if(!file.Read(fileHeader))
return ProbeWantMoreData;
if(!ValidateHeader(fileHeader))
return ProbeFailure;
return ProbeAdditionalSize(file, pfilesize, GetHeaderMinimumAdditionalSize(fileHeader));
}
bool CSoundFile::ReadMUS_KM(FileReader &file, ModLoadingFlags loadFlags)
{
{
file.Rewind();
KMFileHeader fileHeader;
if(!file.Read(fileHeader))
return false;
if(!ValidateHeader(fileHeader))
return false;
if(!file.CanRead(mpt::saturate_cast<FileReader::off_t>(GetHeaderMinimumAdditionalSize(fileHeader))))
return false;
if(loadFlags == onlyVerifyHeader)
return true;
}
file.Rewind();
const auto chunks = ChunkReader(file).ReadChunks<KMChunkHeader>(1);
auto songChunks = chunks.GetAllChunks(KMChunkHeader::idSONG);
auto sampleChunks = chunks.GetAllChunks(KMChunkHeader::idSMPL);
if(songChunks.empty() || sampleChunks.empty())
return false;
InitializeGlobals(MOD_TYPE_MOD);
InitializeChannels();
m_SongFlags = SONG_AMIGALIMITS;
m_nChannels = 4;
m_nSamples = 0;
static constexpr uint16 MUS_SAMPLE_UNUSED = 255; // Sentinel value to check if a sample needs to be duplicated
for(auto &chunk : sampleChunks)
{
if(!CanAddMoreSamples())
break;
m_nSamples++;
ModSample &mptSample = Samples[m_nSamples];
mptSample.Initialize(MOD_TYPE_MOD);
KMSampleHeader sampleHeader;
if(!chunk.Read(sampleHeader)
|| !IsValidKMString(sampleHeader.name))
return false;
m_szNames[m_nSamples] = sampleHeader.name;
mptSample.nLoopEnd = mptSample.nLength = sampleHeader.size;
mptSample.nLoopStart = sampleHeader.loopStart;
mptSample.uFlags.set(CHN_LOOP);
mptSample.nVolume = MUS_SAMPLE_UNUSED;
if(!(loadFlags & loadSampleData))
continue;
SampleIO(SampleIO::_8bit,
SampleIO::mono,
SampleIO::littleEndian,
SampleIO::signedPCM)
.ReadSample(mptSample, chunk);
}
bool firstSong = true;
for(auto &chunk : songChunks)
{
if(!firstSong && !Order.AddSequence())
break;
firstSong = false;
Order().clear();
KMSongHeader songHeader;
if(!chunk.Read(songHeader)
|| songHeader.unknown != 0
|| songHeader.numChannels < 1
|| songHeader.numChannels > 4)
return false;
Order().SetName(mpt::ToUnicode(mpt::Charset::CP437, songHeader.name));
auto musicData = (loadFlags & loadPatternData) ? chunk.ReadChunk(songHeader.musicSize) : FileReader{};
// Map the samples for this subsong
std::array<SAMPLEINDEX, 32> sampleMap{};
for(uint8 smp = 1; smp <= 31; smp++)
{
const auto &srcSample = songHeader.samples[smp - 1];
const auto srcName = mpt::String::ReadAutoBuf(srcSample.name);
if(srcName.empty())
continue;
if(srcSample.finetune > 15 || srcSample.volume > 64 || !IsValidKMString(srcSample.name))
return false;
const auto finetune = MOD2XMFineTune(srcSample.finetune);
const uint16 volume = srcSample.volume * 4u;
SAMPLEINDEX copyFrom = 0;
for(SAMPLEINDEX srcSmp = 1; srcSmp <= m_nSamples; srcSmp++)
{
if(srcName != m_szNames[srcSmp])
continue;
auto &mptSample = Samples[srcSmp];
sampleMap[smp] = srcSmp;
if(mptSample.nVolume == MUS_SAMPLE_UNUSED
|| (mptSample.nFineTune == finetune && mptSample.nVolume == volume))
{
// Sample was not used yet, or it uses the same finetune and volume
mptSample.nFineTune = finetune;
mptSample.nVolume = volume;
copyFrom = 0;
break;
} else
{
copyFrom = srcSmp;
}
}
if(copyFrom && CanAddMoreSamples())
{
m_nSamples++;
sampleMap[smp] = m_nSamples;
const auto &smpFrom = Samples[copyFrom];
auto &newSample = Samples[m_nSamples];
newSample.FreeSample();
newSample = smpFrom;
newSample.nFineTune = finetune;
newSample.nVolume = volume;
newSample.CopyWaveform(smpFrom);
m_szNames[m_nSamples] = m_szNames[copyFrom];
}
}
struct ChannelState
{
ModCommand prevCommand;
uint8 repeat = 0;
};
std::array<ChannelState, 4> chnStates{};
static constexpr ROWINDEX MUS_PATTERN_LENGTH = 64;
const CHANNELINDEX numChannels = static_cast<CHANNELINDEX>(songHeader.numChannels);
PATTERNINDEX pat = PATTERNINDEX_INVALID;
ROWINDEX row = MUS_PATTERN_LENGTH;
ROWINDEX restartRow = 0;
uint32 repeatsLeft = 0;
while(repeatsLeft || musicData.CanRead(1))
{
row++;
if(row >= MUS_PATTERN_LENGTH)
{
pat = Patterns.InsertAny(MUS_PATTERN_LENGTH);
if(pat == PATTERNINDEX_INVALID)
break;
Order().push_back(pat);
row = 0;
}
ModCommand *m = Patterns[pat].GetpModCommand(row, 0);
for(CHANNELINDEX chn = 0; chn < numChannels; chn++, m++)
{
auto &chnState = chnStates[chn];
if(chnState.repeat)
{
chnState.repeat--;
repeatsLeft--;
*m = chnState.prevCommand;
continue;
}
if(!musicData.CanRead(1))
continue;
if(musicData.GetPosition() == songHeader.restartPos)
{
Order().SetRestartPos(Order().GetLastIndex());
restartRow = row;
}
const uint8 note = musicData.ReadUint8();
if(note & 0x80)
{
chnState.repeat = note & 0x7F;
repeatsLeft += chnState.repeat;
*m = chnState.prevCommand;
continue;
}
if(note > 0 && note <= 3 * 12)
m->note = note + NOTE_MIDDLEC - 13;
const auto instr = musicData.ReadUint8();
m->instr = static_cast<ModCommand::INSTR>(sampleMap[instr & 0x1F]);
if(instr & 0x80)
{
m->command = chnState.prevCommand.command;
m->param = chnState.prevCommand.param;
} else
{
static constexpr struct { ModCommand::COMMAND command; uint8 mask; } effTrans[] =
{
{CMD_VOLUME, 0x00}, {CMD_MODCMDEX, 0xA0}, {CMD_MODCMDEX, 0xB0}, {CMD_MODCMDEX, 0x10},
{CMD_MODCMDEX, 0x20}, {CMD_MODCMDEX, 0x50}, {CMD_OFFSET, 0x00}, {CMD_TONEPORTAMENTO, 0x00},
{CMD_TONEPORTAVOL, 0x00}, {CMD_VIBRATO, 0x00}, {CMD_VIBRATOVOL, 0x00}, {CMD_ARPEGGIO, 0x00},
{CMD_PORTAMENTOUP, 0x00}, {CMD_PORTAMENTODOWN, 0x00}, {CMD_VOLUMESLIDE, 0x00}, {CMD_MODCMDEX, 0x90},
{CMD_TONEPORTAMENTO, 0xFF}, {CMD_MODCMDEX, 0xC0}, {CMD_SPEED, 0x00}, {CMD_TREMOLO, 0x00},
};
const auto [command, param] = musicData.ReadArray<uint8, 2>();
if(command < std::size(effTrans))
{
m->command = effTrans[command].command;
m->param = param;
if(m->command == CMD_SPEED && m->param >= 0x20)
m->command = CMD_TEMPO;
else if(effTrans[command].mask)
m->param = effTrans[command].mask | (m->param & 0x0F);
}
}
chnState.prevCommand = *m;
}
}
if((restartRow != 0 || row < (MUS_PATTERN_LENGTH - 1u)) && pat != PATTERNINDEX_INVALID)
{
Patterns[pat].WriteEffect(EffectWriter(CMD_PATTERNBREAK, static_cast<ModCommand::PARAM>(restartRow)).Row(row).RetryNextRow());
}
}
Order.SetSequence(0);
m_modFormat.formatName = U_("Karl Morton Music Format");
m_modFormat.type = U_("mus");
m_modFormat.charset = mpt::Charset::CP437;
return true;
}
OPENMPT_NAMESPACE_END
| 26.795866
| 129
| 0.687464
|
sitomani
|
1210a93b447abbd4031c6035842d95a7a6b718d8
| 3,851
|
hpp
|
C++
|
include/fl/distribution/joint_distribution_id.hpp
|
aeolusbot-tommyliu/fl
|
a50d0c9620a8f86e0cd14a5e22ee0f022d00bd02
|
[
"MIT"
] | 17
|
2015-07-03T06:53:05.000Z
|
2021-05-15T20:55:12.000Z
|
include/fl/distribution/joint_distribution_id.hpp
|
aeolusbot-tommyliu/fl
|
a50d0c9620a8f86e0cd14a5e22ee0f022d00bd02
|
[
"MIT"
] | 3
|
2015-02-20T12:48:17.000Z
|
2019-12-18T08:45:13.000Z
|
include/fl/distribution/joint_distribution_id.hpp
|
aeolusbot-tommyliu/fl
|
a50d0c9620a8f86e0cd14a5e22ee0f022d00bd02
|
[
"MIT"
] | 15
|
2015-02-20T11:34:14.000Z
|
2021-05-15T20:55:13.000Z
|
/*
* This is part of the fl library, a C++ Bayesian filtering library
* (https://github.com/filtering-library)
*
* Copyright (c) 2015 Max Planck Society,
* Autonomous Motion Department,
* Institute for Intelligent Systems
*
* This Source Code Form is subject to the terms of the MIT License (MIT).
* A copy of the license can be found in the LICENSE file distributed with this
* source code.
*/
/**
* \file joint_distribution_id.hpp
* \date Febuary 2015
* \author Jan Issac (jan.issac@gmail.com)
*/
#pragma once
#include <Eigen/Dense>
#include <fl/util/meta.hpp>
#include <fl/util/traits.hpp>
#include <fl/distribution/interface/moments.hpp>
namespace fl
{
// Forward declaration
template <typename...Distribution> class JointDistribution;
/**
* \internal
*
* Traits of JointDistribution<Distribution...>
*/
template <typename...Distribution>
struct Traits<JointDistribution<Distribution...>>
{
enum : signed int
{
JointSize = JoinSizes<SizeOf<typename Distribution::Variate>::Value...>::Size
};
typedef typename FirstTypeIn<
typename Distribution::Variate...
>::Type::Scalar Scalar;
typedef Eigen::Matrix<Scalar, JointSize, 1> Variate;
};
/**
* \ingroup distributions
*/
template <typename...Distribution>
class JointDistribution
: public Moments<typename Traits<JointDistribution<Distribution...>>::Variate>
{
public:
typedef typename Traits<JointDistribution<Distribution...>>::Variate Variate;
typedef typename Moments<Variate>::SecondMoment SecondMoment;
typedef std::tuple<Distribution...> MarginalDistributions;
public:
JointDistribution(Distribution...distributions)
: distributions_(distributions...)
{ }
/**
* \brief Overridable default destructor
*/
virtual ~JointDistribution() noexcept { }
virtual Variate mean() const
{
Variate mu = Variate(dimension(), 1);
mean_<sizeof...(Distribution)>(distributions_, mu);
return mu;
}
virtual SecondMoment covariance() const
{
SecondMoment cov = SecondMoment::Zero(dimension(), dimension());
covariance<sizeof...(Distribution)>(distributions_, cov);
return cov;
}
virtual int dimension() const
{
return expend_dimension(CreateIndexSequence<sizeof...(Distribution)>());
}
MarginalDistributions& distributions()
{
return distributions_;
}
const MarginalDistributions& distributions() const
{
return distributions_;
}
protected:
MarginalDistributions distributions_;
private:
template <int...Indices>
int expend_dimension(IndexSequence<Indices...>) const
{
const auto& dims = { std::get<Indices>(distributions_).dimension()... };
int joint_dim = 0;
for (auto dim : dims) { joint_dim += dim; }
return joint_dim;
}
template <int Size, int k = 0>
void mean_(const MarginalDistributions& distr_tuple,
Variate& mu,
int offset = 0) const
{
auto&& distribution = std::get<k>(distr_tuple);
const int dim = distribution.dimension();
mu.middleRows(offset, dim) = distribution.mean();
if (Size == k + 1) return;
mean_<Size, k + (k + 1 < Size ? 1 : 0)>(distr_tuple, mu, offset + dim);
}
template <int Size, int k = 0>
void covariance(const MarginalDistributions& distr,
SecondMoment& cov,
const int offset = 0) const
{
auto& distribution = std::get<k>(distr);
const int dim = distribution.dimension();
cov.block(offset, offset, dim, dim) = distribution.covariance();
if (Size == k + 1) return;
covariance<Size, k + (k + 1 < Size ? 1 : 0)>(distr, cov, offset + dim);
}
};
}
| 24.528662
| 85
| 0.637237
|
aeolusbot-tommyliu
|
121249c4ef8cc194d5faeb2f4e84d84a1bd71695
| 1,513
|
hpp
|
C++
|
Sources/Sentry/include/SentryThreadMetadataCache.hpp
|
mrtnrst/sentry-cocoa
|
b8724668c3df2a41600d80b7bbde930f70c20f4a
|
[
"MIT"
] | null | null | null |
Sources/Sentry/include/SentryThreadMetadataCache.hpp
|
mrtnrst/sentry-cocoa
|
b8724668c3df2a41600d80b7bbde930f70c20f4a
|
[
"MIT"
] | null | null | null |
Sources/Sentry/include/SentryThreadMetadataCache.hpp
|
mrtnrst/sentry-cocoa
|
b8724668c3df2a41600d80b7bbde930f70c20f4a
|
[
"MIT"
] | null | null | null |
#pragma once
#include "SentryProfilingConditionals.h"
#if SENTRY_TARGET_PROFILING_SUPPORTED
# include "SentryThreadHandle.hpp"
# include <memory>
# include <string>
namespace sentry {
namespace profiling {
struct ThreadMetadata {
thread::TIDType threadID;
std::string name;
int priority;
};
/**
* Caches thread metadata (name, priority, etc.) for reuse while profiling, since querying that
* metadata from the thread every time can be expensive.
*
* @note This class is not thread-safe.
*/
class ThreadMetadataCache {
public:
/**
* Returns the metadata for the thread represented by the specified handle.
* @param thread The thread handle to retrieve metadata from.
* @return @c ThreadMetadata with a non-zero threadID upon success, or a zero
* threadID upon failure, which means that metadata cannot be collected
* for this thread.
*/
ThreadMetadata metadataForThread(const ThreadHandle &thread);
ThreadMetadataCache() = default;
ThreadMetadataCache(const ThreadMetadataCache &) = delete;
ThreadMetadataCache &operator=(const ThreadMetadataCache &) = delete;
private:
struct ThreadHandleMetadataPair {
ThreadHandle::NativeHandle handle;
ThreadMetadata metadata;
};
std::vector<const ThreadHandleMetadataPair> cache_;
};
} // namespace profiling
} // namespace sentry
#endif
| 28.54717
| 99
| 0.663582
|
mrtnrst
|
1214dd82a59c04b979f821f48c34c4c4fef13b65
| 2,713
|
cpp
|
C++
|
src/proto/unit_test/trim_test.cpp
|
jonesholger/lbann
|
3214f189a1438565d695542e076c4fa8e7332d34
|
[
"Apache-2.0"
] | 194
|
2016-07-19T15:40:21.000Z
|
2022-03-19T08:06:10.000Z
|
src/proto/unit_test/trim_test.cpp
|
jonesholger/lbann
|
3214f189a1438565d695542e076c4fa8e7332d34
|
[
"Apache-2.0"
] | 1,021
|
2016-07-19T12:56:31.000Z
|
2022-03-29T00:41:47.000Z
|
src/proto/unit_test/trim_test.cpp
|
jonesholger/lbann
|
3214f189a1438565d695542e076c4fa8e7332d34
|
[
"Apache-2.0"
] | 74
|
2016-07-28T18:24:00.000Z
|
2022-01-24T19:41:04.000Z
|
#include <catch2/catch.hpp>
#include <lbann/proto/proto_common.hpp>
#include <string>
TEST_CASE("Testing string trimming", "[proto][utilities]")
{
SECTION("Leading spaces")
{
CHECK(lbann::trim(" my string") == "my string");
CHECK(lbann::trim("\nmy string") == "my string");
CHECK(lbann::trim("\tmy string") == "my string");
CHECK(lbann::trim(" \n\tmy string") == "my string");
CHECK(lbann::trim(" my string") == "my string");
}
SECTION("Trailing spaces")
{
CHECK(lbann::trim("my string ") == "my string");
CHECK(lbann::trim("my string\n") == "my string");
CHECK(lbann::trim("my string\t") == "my string");
CHECK(lbann::trim("my string \n\t") == "my string");
CHECK(lbann::trim("my string ") == "my string");
}
SECTION("Leading and trailing spaces")
{
CHECK(lbann::trim(" my string ") == "my string");
CHECK(lbann::trim(" my string\n") == "my string");
CHECK(lbann::trim(" my string\t") == "my string");
CHECK(lbann::trim(" my string \n\t") == "my string");
CHECK(lbann::trim(" my string ") == "my string");
CHECK(lbann::trim("\nmy string ") == "my string");
CHECK(lbann::trim("\nmy string\n") == "my string");
CHECK(lbann::trim("\nmy string\t") == "my string");
CHECK(lbann::trim("\nmy string \n\t") == "my string");
CHECK(lbann::trim("\nmy string ") == "my string");
CHECK(lbann::trim("\tmy string ") == "my string");
CHECK(lbann::trim("\tmy string\n") == "my string");
CHECK(lbann::trim("\tmy string\t") == "my string");
CHECK(lbann::trim("\tmy string \n\t") == "my string");
CHECK(lbann::trim("\tmy string ") == "my string");
CHECK(lbann::trim(" \n\tmy string ") == "my string");
CHECK(lbann::trim(" \n\tmy string\n") == "my string");
CHECK(lbann::trim(" \n\tmy string\t") == "my string");
CHECK(lbann::trim(" \n\tmy string \n\t") == "my string");
CHECK(lbann::trim(" \n\tmy string ") == "my string");
CHECK(lbann::trim(" my string ") == "my string");
CHECK(lbann::trim(" my string\n") == "my string");
CHECK(lbann::trim(" my string\t") == "my string");
CHECK(lbann::trim(" my string \n\t") == "my string");
CHECK(lbann::trim(" my string ") == "my string");
}
SECTION("Neither leading nor trailing spaces")
{
CHECK(lbann::trim("my string") == "my string");
CHECK(lbann::trim("lbann") == "lbann");
}
SECTION("Only spaces")
{
CHECK(lbann::trim(" ") == "");
CHECK(lbann::trim("\n") == "");
CHECK(lbann::trim("\t") == "");
CHECK(lbann::trim(" \n\t") == "");
CHECK(lbann::trim(" \t\n\t") == "");
}
SECTION("Empty string")
{
CHECK(lbann::trim("") == "");
}
}
| 36.173333
| 61
| 0.552156
|
jonesholger
|
121816faca874aade296c850755296d763619378
| 651
|
cpp
|
C++
|
src/GateNetworks.Parser/network/connection_parser.cpp
|
jurajtrappl/Gate-networks
|
84c15684124a99bc16cf8ca20d1d39fc7c31b5b1
|
[
"MIT"
] | null | null | null |
src/GateNetworks.Parser/network/connection_parser.cpp
|
jurajtrappl/Gate-networks
|
84c15684124a99bc16cf8ca20d1d39fc7c31b5b1
|
[
"MIT"
] | null | null | null |
src/GateNetworks.Parser/network/connection_parser.cpp
|
jurajtrappl/Gate-networks
|
84c15684124a99bc16cf8ca20d1d39fc7c31b5b1
|
[
"MIT"
] | null | null | null |
#include "connection_parser.h"
#include "connection_definitions.h"
#include "../input_file_exceptions.h"
using namespace std;
namespace gate_networks::parser::network
{
void ConnectionParser::configure_strategy(const ArrowTokens& tokens)
{
strategy_->configure(tokens, current_line_number_);
}
void ConnectionParser::set_strategy(Connection_type_key key)
{
if (types_.find(key) != types_.end())
{
strategy_ = types_[key];
}
else
{
throw BindingRuleException(current_line_number_);
}
}
void ConnectionParser::process(std::shared_ptr<core::components::GateNetwork> gate_network)
{
strategy_->connect(gate_network);
}
}
| 21.7
| 92
| 0.752688
|
jurajtrappl
|
12198d3531031bd482aeea6172fcc114735cc67d
| 10,483
|
cpp
|
C++
|
src/render/debug/DebugRenderer.cpp
|
ErnestasJa/TheEngine2
|
a16778e18b844c2044cf3bab31f661c1fb3da840
|
[
"MIT"
] | 2
|
2015-12-16T22:02:53.000Z
|
2018-04-10T14:43:26.000Z
|
src/render/debug/DebugRenderer.cpp
|
ErnestasJa/TheEngine2
|
a16778e18b844c2044cf3bab31f661c1fb3da840
|
[
"MIT"
] | 48
|
2015-12-20T14:23:49.000Z
|
2016-07-18T12:15:37.000Z
|
src/render/debug/DebugRenderer.cpp
|
ErnestasJa/TheEngine2
|
a16778e18b844c2044cf3bab31f661c1fb3da840
|
[
"MIT"
] | 1
|
2015-12-20T14:30:26.000Z
|
2015-12-20T14:30:26.000Z
|
#include "render/debug/DebugRenderer.h"
#include <render/BaseMaterial.h>
#include <render/BaseMesh.h>
#include <render/ICamera.h>
#include <render/IGpuBufferArrayObject.h>
#include <render/IGpuBufferObject.h>
#include <render/IRenderContext.h>
#include <render/IRenderer.h>
#include <resource_management/ResourceManagementInc.h>
namespace render {
template <class TPrimitiveType> inline int32_t PrimiteCountPerObject()
{
if constexpr (std::is_same<TPrimitiveType, DebugLineObject>::value) {
return 2;
}
else if constexpr (std::is_same<TPrimitiveType, DebugAABVObject>::value) {
return 8 * 3;
}
return 3;
}
DebugMesh::DebugMesh(core::UniquePtr<render::IGpuBufferArrayObject> vao, int32_t bufferSize)
: m_vao(core::Move(vao))
, m_bufferSize(bufferSize)
{
}
void DebugMesh::Init()
{
// m_vao->GetBufferObject(0)->UpdateBuffer(m_bufferSize, nullptr);
m_vao->GetBufferObject(1)->UpdateBuffer(m_bufferSize, nullptr);
m_vao->GetBufferObject(2)->UpdateBuffer(m_bufferSize, nullptr);
IndexBuffer.resize(m_bufferSize);
VertexBuffer.resize(m_bufferSize);
ColorBuffer.resize(m_bufferSize);
for (int i = 0; i < IndexBuffer.size(); i++) {
IndexBuffer[i] = i;
}
m_vao->GetBufferObject(0)->UpdateBuffer(m_bufferSize, IndexBuffer.data());
}
void DebugMesh::PartialUpdate(int32_t start, int32_t count)
{
m_vao->GetBufferObject(1)->UpdateBufferSubData(start, count, &VertexBuffer[start]);
m_vao->GetBufferObject(2)->UpdateBufferSubData(start, count, &ColorBuffer[start]);
}
void DebugMesh::Render(int32_t count)
{
m_vao->RenderLines(count);
}
void UpdateBuffer(DebugMesh* mesh, const DebugAABVObject& obj)
{
int32_t pos = obj.Index * PrimiteCountPerObject<DebugAABVObject>();
for(int i = pos; i < pos + PrimiteCountPerObject<DebugAABVObject>(); i++){
mesh->ColorBuffer[i] = obj.Color;
}
//bottom
mesh->VertexBuffer[pos] = obj.Start;
mesh->VertexBuffer[pos + 1] = {obj.End.x, obj.Start.y, obj.Start.z};
mesh->VertexBuffer[pos + 2] = {obj.End.x, obj.Start.y, obj.Start.z};
mesh->VertexBuffer[pos + 3] = {obj.End.x, obj.Start.y, obj.End.z};
mesh->VertexBuffer[pos + 4] = {obj.End.x, obj.Start.y, obj.End.z};
mesh->VertexBuffer[pos + 5] = {obj.Start.x, obj.Start.y, obj.End.z};
mesh->VertexBuffer[pos + 6] = obj.Start;
mesh->VertexBuffer[pos + 7] = {obj.Start.x, obj.Start.y, obj.End.z};
//sides
mesh->VertexBuffer[pos + 8] = obj.Start;
mesh->VertexBuffer[pos + 9] = {obj.Start.x, obj.End.y, obj.Start.z};
mesh->VertexBuffer[pos + 10] = {obj.Start.x, obj.Start.y, obj.End.z};
mesh->VertexBuffer[pos + 11] = {obj.Start.x, obj.End.y, obj.End.z};
mesh->VertexBuffer[pos + 12] = {obj.End.x, obj.Start.y, obj.Start.z};
mesh->VertexBuffer[pos + 13] = {obj.End.x, obj.End.y, obj.Start.z};
mesh->VertexBuffer[pos + 14] = {obj.End.x, obj.Start.y, obj.End.z};
mesh->VertexBuffer[pos + 15] = obj.End;
//top
mesh->VertexBuffer[pos + 16] = {obj.Start.x, obj.End.y, obj.Start.z};
mesh->VertexBuffer[pos + 17] = {obj.End.x, obj.End.y, obj.Start.z};
mesh->VertexBuffer[pos + 18] = {obj.End.x, obj.End.y, obj.Start.z};
mesh->VertexBuffer[pos + 19] = obj.End;
mesh->VertexBuffer[pos + 20] = obj.End;
mesh->VertexBuffer[pos + 21] = {obj.Start.x, obj.End.y, obj.End.z};
mesh->VertexBuffer[pos + 22] = {obj.Start.x, obj.End.y, obj.End.z};
mesh->VertexBuffer[pos + 23] = {obj.Start.x, obj.End.y, obj.Start.z};
mesh->PartialUpdate(pos, PrimiteCountPerObject<DebugAABVObject>());
}
void UpdateBuffer(DebugMesh* mesh, const DebugLineObject & obj)
{
int32_t pos = obj.Index * 2;
mesh->ColorBuffer[pos] = obj.Color;
mesh->ColorBuffer[pos + 1] = obj.Color;
mesh->VertexBuffer[pos] = obj.Start;
mesh->VertexBuffer[pos + 1] = obj.End;
mesh->PartialUpdate(pos, PrimiteCountPerObject<DebugLineObject>());
}
template <class T>
core::UniquePtr<DebugMesh> CreateDebugMesh(IRenderer * renderer, uint32_t maxObjects)
{
auto vao = renderer->CreateBufferArrayObject({
render::BufferDescriptor{ 1, render::BufferObjectType::index,
render::BufferComponentDataType::uint32, 0,
render::BufferUsageHint::StaticDraw },
render::BufferDescriptor{ 3, render::BufferObjectType::vertex,
render::BufferComponentDataType::float32, 0,
render::BufferUsageHint::StaticDraw },
render::BufferDescriptor{ 3, render::BufferObjectType::vertex,
render::BufferComponentDataType::float32, 1,
render::BufferUsageHint::StaticDraw },
});
auto debugMesh = core::MakeUnique<DebugMesh>(core::Move(vao),
maxObjects * PrimiteCountPerObject<T>());
debugMesh->Init();
return debugMesh;
}
DebugRenderer::DebugRenderer(int32_t maxObjects, IRenderer* renderer,
res::ResourceManager* resource_manager)
: m_debuggerAbsTimeElapsed(0)
, m_maxObjects(maxObjects)
, m_renderer(renderer)
, m_resource_manager(resource_manager)
, m_totalActiveLineObjects(0)
, m_totalActiveAABVObjects(0)
{
m_lines = CreateDebugMesh<DebugLineObject>(m_renderer, m_maxObjects);
m_aabvs = CreateDebugMesh<DebugAABVObject>(m_renderer, m_maxObjects);
m_lineObjects.resize(m_maxObjects);
m_aabvObjects.resize(m_maxObjects);
m_material = m_resource_manager->LoadMaterial("resources/shaders/debug_renderer");
m_material->RenderMode = material::MeshRenderMode::Lines;
m_material->UseDepthTest = false;
}
template <class TObjectType>
const char* GetObjectName(){
if constexpr (std::is_same<TObjectType, DebugLineObject>::value) {
return "Line";
}
else if constexpr (std::is_same<TObjectType, DebugAABVObject>::value) {
return "AABV";
}
return "";
}
template <class TObjectType>
void UpdateObjects(float currentTime, int32_t& totalActiveObjects, core::Vector<TObjectType> & objects, DebugMesh* mesh){
int32_t lastActiveObjIndex = totalActiveObjects - 1;
if (lastActiveObjIndex < 0) {
return;
}
core::Vector<int> m_expiredObjects;
for (int i = 0; i < objects.size(); i++) {
auto& obj = objects[i];
if (obj.Alive && ((obj.TimeToLive + obj.AbsTimeAdded) <= currentTime)) {
obj.Alive = false;
totalActiveObjects--;
m_expiredObjects.push_back(i);
//elog::LogInfo(core::string::format("{} expired. Total lines: {}", GetObjectName<TObjectType>(), totalActiveObjects));
}
}
if (m_expiredObjects.size() == 0) {
return;
}
int currentExpiredToBeFilled = 0;
int expiredIndex = m_expiredObjects[currentExpiredToBeFilled];
int lastExpiredObj = m_expiredObjects.size() - 1;
while (true) {
if (lastActiveObjIndex > 0) {
auto& lastActive = objects[lastActiveObjIndex];
if (lastActive.Alive) {
auto& expired = objects[expiredIndex];
expired = objects[lastActiveObjIndex];
expired.Index = expiredIndex;
lastActive.Alive = false;
UpdateBuffer(mesh, expired);
currentExpiredToBeFilled++;
if (currentExpiredToBeFilled > lastExpiredObj) {
break;
}
expiredIndex = m_expiredObjects[currentExpiredToBeFilled];
}
}
lastActiveObjIndex--;
if (expiredIndex >= lastActiveObjIndex) {
break;
}
}
mesh->PartialUpdate(0, PrimiteCountPerObject<DebugLineObject>() * totalActiveObjects);
}
void DebugRenderer::Update(float deltaMs)
{
m_debuggerAbsTimeElapsed += deltaMs;
UpdateObjects(m_debuggerAbsTimeElapsed, m_totalActiveAABVObjects, m_aabvObjects, m_aabvs.get());
UpdateObjects(m_debuggerAbsTimeElapsed, m_totalActiveLineObjects, m_lineObjects, m_lines.get());
}
void DebugRenderer::Render()
{
if(!m_totalActiveAABVObjects && !m_totalActiveLineObjects){
return;
}
auto camera = m_renderer->GetRenderContext()->GetCurrentCamera();
m_renderer->GetRenderContext()->SetCurrentMaterial(m_material.get());
m_material->SetMat4("MVP", camera->GetProjection() * camera->GetView() * glm::mat4(1));
if(m_totalActiveLineObjects) {
m_lines->Render(m_totalActiveLineObjects * PrimiteCountPerObject<DebugLineObject>());
}
if(m_totalActiveAABVObjects){
m_aabvs->Render(m_totalActiveAABVObjects * PrimiteCountPerObject<DebugAABVObject>());
}
}
void DebugRenderer::AddLine(glm::vec3 start, glm::vec3 end, float lifeTimeSeconds)
{
auto expiredLineIt = std::find_if(std::begin(m_lineObjects), std::end(m_lineObjects),
[](const DebugLineObject& obj) { return obj.Alive == false; });
int32_t index;
if (expiredLineIt != std::end(m_lineObjects)) {
index = std::distance(std::begin(m_lineObjects), expiredLineIt);
}
else {
//elog::LogInfo("Failed to add debug line. Too many active debug line objects already.");
return;
}
DebugLineObject obj;
obj.Alive = true;
obj.Index = index;
obj.Start = start;
obj.End = end;
obj.Color = { 1.f, 0, 0 };
obj.AbsTimeAdded = m_debuggerAbsTimeElapsed;
obj.TimeToLive = lifeTimeSeconds * 1000.0f;
m_lineObjects[index] = obj;
UpdateBuffer(m_lines.get(), obj);
m_totalActiveLineObjects++;
//elog::LogInfo(core::string::format("Line added. Total lines: {}", m_totalActiveLineObjects));
}
void DebugRenderer::AddAABV(glm::vec3 start, glm::vec3 end, float lifeTimeSeconds)
{
auto expiredIt = std::find_if(std::begin(m_aabvObjects), std::end(m_aabvObjects),
[](const DebugAABVObject& obj) { return obj.Alive == false; });
int32_t index;
if (expiredIt != std::end(m_aabvObjects)) {
index = std::distance(std::begin(m_aabvObjects), expiredIt);
}
else {
//elog::LogInfo("Failed to add debug line. Too many active debug line objects already.");
return;
}
DebugAABVObject obj;
obj.Alive = true;
obj.Index = index;
obj.Start = start;
obj.End = end;
obj.Color = { 0, 1, 0 };
obj.AbsTimeAdded = m_debuggerAbsTimeElapsed;
obj.TimeToLive = lifeTimeSeconds * 1000.0f;
m_aabvObjects[index] = obj;
UpdateBuffer(m_aabvs.get(), obj);
m_totalActiveAABVObjects++;
//elog::LogInfo(core::string::format("AABV added. Total AABVs: {}", m_totalActiveAABVObjects));
}
} // namespace render
| 32.759375
| 125
| 0.66708
|
ErnestasJa
|
121a96388df6079465965fd1b2caad9b8459c814
| 7,980
|
cpp
|
C++
|
test/framework/tCommandLineArgs.cpp
|
xiaohongchen1991/clang-xform
|
bd0cf899760b53b24e10ca4baab3c4e281535b97
|
[
"MIT"
] | 2
|
2020-02-18T18:09:45.000Z
|
2020-05-10T18:38:38.000Z
|
test/framework/tCommandLineArgs.cpp
|
xiaohongchen1991/clang-xform
|
bd0cf899760b53b24e10ca4baab3c4e281535b97
|
[
"MIT"
] | null | null | null |
test/framework/tCommandLineArgs.cpp
|
xiaohongchen1991/clang-xform
|
bd0cf899760b53b24e10ca4baab3c4e281535b97
|
[
"MIT"
] | 1
|
2020-02-18T18:09:48.000Z
|
2020-02-18T18:09:48.000Z
|
/*
MIT License
Copyright (c) 2019 Xiaohong Chen
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.
*/
#include "CommandLineArgs.hpp"
#include <fstream>
#include <cstdio>
#include "gtest/gtest.h"
TEST(CommandLineArgsTest, AdjustCommandLineArgs_NonMatcherArgs) {
CommandLineArgs args;
args.matchers.push_back("m1");
args.inputFiles.push_back("f1");
args.configFile = "tmp.cfg";
std::vector<std::string> matcherArgs;
std::ofstream ofs(args.configFile);
ofs << "matchers =m2\n"
<< "input-files= f2";
ofs.close();
AdjustCommandLineArgs(args, matcherArgs);
// remove tmp config file
remove(args.configFile.c_str());
std::vector<std::string> bmatchers = {"m1", "m2"};
std::vector<std::string> bfiles = {"f1", "f2"};
EXPECT_EQ(args.matchers, bmatchers);
EXPECT_EQ(args.inputFiles, bfiles);
EXPECT_TRUE(matcherArgs.empty());
}
TEST(CommandLineArgsTest, AdjustCommandLineArgs_MatcherArgs) {
CommandLineArgs args;
args.configFile = "tmp.cfg";
std::vector<std::string> matcherArgs = {"--matcher-args-m1", "--bc", "3"};
std::ofstream ofs(args.configFile);
ofs << "matcher-args-m2 --abc 2\n"
<< "matcher-args-m2 --ab 1";
ofs.close();
AdjustCommandLineArgs(args, matcherArgs);
// remove tmp config file
remove(args.configFile.c_str());
std::vector<std::string> bmatcherArgs = {"--matcher-args-m1", "--bc", "3",
"--matcher-args-m2", "--abc", "2",
"--matcher-args-m2", "--ab", "1"};
EXPECT_TRUE(args.matchers.empty());
EXPECT_TRUE(args.inputFiles.empty());
EXPECT_EQ(matcherArgs, bmatcherArgs);
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_InputFilesWithMatchers) {
// test --components flag
std::string errmsg;
constexpr int argc = 6;
// args: clang_xform --input-files f1 f2 -m RenameFcn \
// --matcher-args-RenameFcn --qualified-name Foo --new-name Bar
const char* argv[argc] = {"clang_xform", "--input-files", "f1", "f2", "-m", "RenameFcn"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
std::vector<std::string> matcherArgs = {"--matcher-args-RenameFcn", "--qualified-name", "Foo",
"--new-name", "Bar"};
EXPECT_TRUE(ValidateCommandLineArgs(args, matcherArgs, false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_Apply) {
// test --apply flag
std::string errmsg;
constexpr int argc = 3;
// args: clang_xform -a output.yaml
const char* argv[argc] = {"clang_xform", "-a", "output.yaml"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_TRUE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_Display) {
// test --display flag
std::string errmsg;
constexpr int argc = 2;
// args: clang_xform -d
const char* argv[argc] = {"clang_xform", "-d"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_TRUE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_CompDBWithClangFlags) {
// test mutually exclusive flags between --compile-commands and clang flags
std::string errmsg;
constexpr int argc = 3;
// args: clang_xform --compile-commands compdb.json --
const char* argv[argc] = {"clang_xform", "--compile-commands", "compdb.json"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), true, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_DisplayWithOtherFlags) {
// test mutually exclusive flags between --display and all the others
std::string errmsg;
constexpr int argc = 4;
// args: clang_xform --display --input-files f1
const char* argv[argc] = {"clang_xform", "--display", "--input-files", "f1"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_ApplyWithOtherFlags) {
// test mutually exclusive flags between --apply and all the others
std::string errmsg;
constexpr int argc = 4;
// args: clang_xform --apply output.yaml -d
const char* argv[argc] = {"clang_xform", "--apply", "output.yaml", "-d"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_InvalidExtForApplyFile) {
// error out if the applied file extension is not .yaml
std::string errmsg;
constexpr int argc = 3;
// args: clang_xform -a output.xml
const char* argv[argc] = {"clang_xform", "-a", "output.xml"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_InvalidExtForOutputFile) {
// error out if the output file extension is not .yaml
std::string errmsg;
constexpr int argc = 5;
// args: clang_xform --output output --input-files f1
const char* argv[argc] = {"clang_xform", "--output", "output", "--input-files", "f1"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_UnregisteredMatcher) {
std::string errmsg;
// error out if the selected matcher is unregisted
// args: clang_xform --input-files f1 --matchers m1
constexpr int argc = 5;
const char* argv[argc] = {"clang_xform", "--input-files", "f1", "--matchers", "m1"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_InvalidMatcherArgs) {
std::string errmsg;
constexpr int argc = 5;
// error out when arguments are provided for a non-selected matcher Foo
// args: clang_xform --input-files f --matchers RenameFcn --matcher-args-Foo --abc 1
const char* argv[argc] = {"clang_xform", "--input-files", "f", "--matchers", "RenameFcn"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
std::vector<std::string> matcherArgs = {"--matcher-args-Foo", "--abc", "1"};
EXPECT_FALSE(ValidateCommandLineArgs(args, matcherArgs, false, errmsg));
}
TEST(CommandLineArgsTest, ValidateCommandLineArgs_NoMatcher) {
std::string errmsg;
constexpr int argc = 3;
// error out if no matcher is selected to run over files or components
// args: clang_xform --input-files f
const char* argv[argc] = {"clang_xform", "--input-files", "f"};
auto args = ProcessCommandLine(argc, const_cast<char**>(argv));
EXPECT_FALSE(ValidateCommandLineArgs(args, std::vector<std::string>(), false, errmsg));
}
| 43.135135
| 96
| 0.709148
|
xiaohongchen1991
|
121ede548c2fe7492bdbc2a87c62067dcd8fc9af
| 7,371
|
cpp
|
C++
|
test/test_mlr.cpp
|
angeloskath/supervised-lda
|
fe3a39bb0d6c7d0c2a33f069440869ad70774da8
|
[
"MIT"
] | 22
|
2017-05-25T11:59:02.000Z
|
2021-08-30T08:51:41.000Z
|
test/test_mlr.cpp
|
angeloskath/supervised-lda
|
fe3a39bb0d6c7d0c2a33f069440869ad70774da8
|
[
"MIT"
] | 22
|
2016-06-30T15:51:18.000Z
|
2021-12-06T10:43:16.000Z
|
test/test_mlr.cpp
|
angeloskath/supervised-lda
|
fe3a39bb0d6c7d0c2a33f069440869ad70774da8
|
[
"MIT"
] | 4
|
2017-09-28T14:58:01.000Z
|
2020-12-21T14:22:38.000Z
|
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <Eigen/Core>
#include <gtest/gtest.h>
#include "test/utils.hpp"
#include "ldaplusplus/optimization/MultinomialLogisticRegression.hpp"
#include "ldaplusplus/optimization/GradientDescent.hpp"
using namespace Eigen;
using namespace ldaplusplus::optimization;
template <typename T>
class TestMultinomialLogisticRegression : public ParameterizedTest<T> {};
TYPED_TEST_CASE(TestMultinomialLogisticRegression, ForFloatAndDouble);
/**
* In this test we check if the gradient is correct by appling
* a finite difference method.
*/
TYPED_TEST(TestMultinomialLogisticRegression, Gradient) {
// Gradient checking should only be made with a double type
if (is_float<TypeParam>::value) {
return;
}
// eta is typically of size KxC, where K is the number of topics and C the
// number of different classes.
// Here we choose randomly for conviency K=10 and C=5
MatrixX<TypeParam> eta = MatrixX<TypeParam>::Random(10, 5);
// X is of size KxD, where D is the total number of documents.
// In our case we have chosen D=15
MatrixX<TypeParam> X = MatrixX<TypeParam>::Random(10, 1);
// y is vector of size Dx1
VectorXi y(1);
for (int i=0; i<1; i++) {
y(i) = rand() % (int)5;
}
TypeParam L = 1;
MultinomialLogisticRegression<TypeParam> mlr(X, y, L);
// grad is the gradient according to the equation
// implemented in MultinomialLogisticRegression.cpp
// gradient function
// grad is of same size as eta, which is KxC
MatrixX<TypeParam> grad(10, 5);
// Calculate the gradients
mlr.gradient(eta, grad);
// Grad's approximation
TypeParam grad_hat;
TypeParam t = 1e-4;
for (int i=0; i < eta.rows(); i++) {
for (int j=0; j < eta.cols(); j++) {
eta(i, j) += t;
TypeParam ll1 = mlr.value(eta);
eta(i, j) -= 2*t;
TypeParam ll2 = mlr.value(eta);
// Compute gradients approximation
grad_hat = (ll1 - ll2) / (2 * t);
auto absolute_error = std::abs(grad(i, j) - grad_hat);
if (grad_hat != 0) {
auto relative_error = absolute_error / std::abs(grad_hat);
EXPECT_TRUE(
relative_error < 1e-4 ||
absolute_error < 1e-5
) << relative_error << " " << absolute_error;
}
else {
EXPECT_LT(absolute_error, 1e-5);
}
}
}
}
/**
* In this test we check whether the minimizer works as expected on the Fisher
* Iris dataset. We have isolated three classed from Fisher Iris and just two
* features, from the total four.
* We compare the results from our Minimizer with the corresponding results from
* LogisticRegression's implementation of SKlearn with the same initial parameters.
*/
TYPED_TEST(TestMultinomialLogisticRegression, Minimizer) {
// X contains the two features from Fisher Iris
MatrixX<TypeParam> Xin(150, 2);
Xin << 5.1, 3.5, 4.9, 3., 4.7, 3.2, 4.6, 3.1, 5., 3.6, 5.4, 3.9, 4.6, 3.4, 5., 3.4,
4.4, 2.9, 4.9, 3.1, 5.4, 3.7, 4.8, 3.4, 4.8, 3., 4.3, 3., 5.8, 4., 5.7, 4.4,
5.4, 3.9, 5.1, 3.5, 5.7, 3.8, 5.1, 3.8, 5.4, 3.4, 5.1, 3.7, 4.6, 3.6, 5.1, 3.3,
4.8, 3.4, 5., 3., 5., 3.4, 5.2, 3.5, 5.2, 3.4, 4.7, 3.2, 4.8, 3.1, 5.4, 3.4,
5.2, 4.1, 5.5, 4.2, 4.9, 3.1, 5., 3.2, 5.5, 3.5, 4.9, 3.1, 4.4, 3., 5.1, 3.4,
5., 3.5, 4.5, 2.3, 4.4, 3.2, 5., 3.5, 5.1, 3.8, 4.8, 3., 5.1, 3.8, 4.6, 3.2,
5.3, 3.7, 5., 3.3, 7., 3.2, 6.4, 3.2, 6.9, 3.1, 5.5, 2.3, 6.5, 2.8, 5.7, 2.8,
6.3, 3.3, 4.9, 2.4, 6.6, 2.9, 5.2, 2.7, 5., 2., 5.9, 3., 6., 2.2, 6.1, 2.9,
5.6, 2.9, 6.7, 3.1, 5.6, 3., 5.8, 2.7, 6.2, 2.2, 5.6, 2.5, 5.9, 3.2, 6.1, 2.8,
6.3, 2.5, 6.1, 2.8, 6.4, 2.9, 6.6, 3., 6.8, 2.8, 6.7, 3., 6., 2.9, 5.7, 2.6,
5.5, 2.4, 5.5, 2.4, 5.8, 2.7, 6., 2.7, 5.4, 3., 6., 3.4, 6.7, 3.1, 6.3, 2.3,
5.6, 3., 5.5, 2.5, 5.5, 2.6, 6.1, 3., 5.8, 2.6, 5., 2.3, 5.6, 2.7, 5.7, 3.,
5.7, 2.9, 6.2, 2.9, 5.1, 2.5, 5.7, 2.8, 6.3, 3.3, 5.8, 2.7, 7.1, 3., 6.3, 2.9,
6.5, 3., 7.6, 3., 4.9, 2.5, 7.3, 2.9, 6.7, 2.5, 7.2, 3.6, 6.5, 3.2, 6.4, 2.7,
6.8, 3., 5.7, 2.5, 5.8, 2.8, 6.4, 3.2, 6.5, 3., 7.7, 3.8, 7.7, 2.6, 6., 2.2,
6.9, 3.2, 5.6, 2.8, 7.7, 2.8, 6.3, 2.7, 6.7, 3.3, 7.2, 3.2, 6.2, 2.8, 6.1, 3.,
6.4, 2.8, 7.2, 3., 7.4, 2.8, 7.9, 3.8, 6.4, 2.8, 6.3, 2.8, 6.1, 2.6, 7.7, 3.,
6.3, 3.4, 6.4, 3.1, 6., 3., 6.9, 3.1, 6.7, 3.1, 6.9, 3.1, 5.8, 2.7, 6.8, 3.2,
6.7, 3.3, 6.7, 3., 6.3, 2.5, 6.5, 3., 6.2, 3.4, 5.9, 3.;
MatrixX<TypeParam> X(2, 150);
X = Xin.transpose();
// y is a vector of size Dx1, which contains class labels
VectorXi y(150);
y << 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2;
TypeParam regularization_penalty = 1e-2;
MultinomialLogisticRegression<TypeParam> mlr(
X,
y,
regularization_penalty
);
MatrixX<TypeParam> eta = MatrixX<TypeParam>::Zero(2, 3);
GradientDescent<MultinomialLogisticRegression<TypeParam>, MatrixX<TypeParam>> minimizer(
std::make_shared<ArmijoLineSearch<MultinomialLogisticRegression<TypeParam>, MatrixX<TypeParam>> >(),
[](TypeParam value, TypeParam gradNorm, size_t iterations) {
return iterations < 500;
}
);
minimizer.minimize(mlr, eta);
MatrixX<TypeParam> lbfgs_eta(2, 3);
lbfgs_eta << -4.57679568, 2.03822995, 2.53856573, 8.12944469, -3.53562038, -4.59382431;
VectorX<TypeParam> cosine_similarities = (lbfgs_eta.transpose() * eta).diagonal();
cosine_similarities.array() /= eta.colwise().norm().array();
cosine_similarities.array() /= lbfgs_eta.colwise().norm().array();
const double pi = std::acos(-1);
for (int i=0; i<cosine_similarities.rows(); i++) {
EXPECT_LT(std::cos(2*pi/180), cosine_similarities[i]);
}
}
TYPED_TEST(TestMultinomialLogisticRegression, MinimizerOverfitSmall) {
MatrixX<TypeParam> X(2, 10);
VectorXi y(10);
X << 0.6097662 , 0.53395565, 0.9499446 , 0.67289898, 0.94173948,
0.56675891, 0.80363783, 0.85303565, 0.15903886, 0.99518533,
0.41655682, 0.29256121, 0.36103228, 0.29899503, 0.4957268 ,
-0.04277318, -0.28038614, -0.12334621, -0.17497722, 0.1492248;
y << 0, 0, 0, 0, 0, 1, 1, 1, 1, 1;
MultinomialLogisticRegression<TypeParam> mlr(X, y, 0);
MatrixX<TypeParam> eta = MatrixX<TypeParam>::Zero(2, 3);
GradientDescent<MultinomialLogisticRegression<TypeParam>, MatrixX<TypeParam>> minimizer(
std::make_shared<ArmijoLineSearch<MultinomialLogisticRegression<TypeParam>, MatrixX<TypeParam>> >(),
[](TypeParam value, TypeParam gradNorm, size_t iterations) {
return iterations < 5000;
}
);
minimizer.minimize(mlr, eta);
EXPECT_GT(1e-2, mlr.value(eta));
}
| 40.059783
| 108
| 0.559761
|
angeloskath
|
12215e92ec6ed2e86b4ec2ff910aef7c18afa9d6
| 5,414
|
cpp
|
C++
|
telnetpp/src/options/new_environ/detail/response_parser.cpp
|
CalielOfSeptem/septem
|
fe7a615eb6c279d3746ee78de8864b5e07bf7e3e
|
[
"MIT"
] | 1
|
2017-03-30T14:31:33.000Z
|
2017-03-30T14:31:33.000Z
|
telnetpp/src/options/new_environ/detail/response_parser.cpp
|
HoraceWeebler/septem
|
fe7a615eb6c279d3746ee78de8864b5e07bf7e3e
|
[
"MIT"
] | null | null | null |
telnetpp/src/options/new_environ/detail/response_parser.cpp
|
HoraceWeebler/septem
|
fe7a615eb6c279d3746ee78de8864b5e07bf7e3e
|
[
"MIT"
] | null | null | null |
#include "telnetpp/options/new_environ/detail/response_parser.hpp"
#include "telnetpp/options/new_environ/detail/protocol.hpp"
namespace telnetpp { namespace options { namespace new_environ {
namespace detail {
namespace {
enum class parse_state
{
is_or_info,
type,
name,
name_esc,
value,
value_esc,
};
static telnetpp::options::new_environ::variable_type u8_to_type(
telnetpp::u8 value)
{
return value == telnetpp::options::new_environ::detail::var
? telnetpp::options::new_environ::variable_type::var
: telnetpp::options::new_environ::variable_type::uservar;
}
// ==========================================================================
// PARSE_VALUE_ESC
// ==========================================================================
boost::optional<response> parse_value_esc(
parse_state &state, response &temp, u8 data)
{
temp.value->push_back(data);
state = parse_state::value;
return {};
}
// ==========================================================================
// PARSE_VALUE
// ==========================================================================
boost::optional<response> parse_value(
parse_state &state, response &temp, u8 data)
{
boost::optional<response> resp;
switch (data)
{
case detail::esc :
state = parse_state::value_esc;
break;
case detail::var : // Fall-through
case detail::uservar :
resp = temp;
temp.type = u8_to_type(data);
temp.name = "";
temp.value = boost::none;
state = parse_state::name;
break;
default :
temp.value->push_back(data);
break;
}
return resp;
}
// ==========================================================================
// PARSE_NAME_ESC
// ==========================================================================
boost::optional<response> parse_name_esc(
parse_state &state, response &temp, u8 data)
{
temp.name.push_back(char(data));
state = parse_state::name;
return {};
}
// ==========================================================================
// PARSE_NAME
// ==========================================================================
boost::optional<response> parse_name(
parse_state &state, response &temp, u8 data)
{
boost::optional<response> resp;
switch (data)
{
case detail::esc :
state = parse_state::name_esc;
break;
case detail::var : // Fall-through
case detail::uservar :
resp = temp;
temp.type = u8_to_type(data);
temp.name = "";
temp.value = boost::none;
state = parse_state::name;
break;
case detail::value :
temp.value = "";
state = parse_state::value;
break;
default :
temp.name.push_back(char(data));
break;
}
return resp;
}
// ==========================================================================
// PARSE_TYPE
// ==========================================================================
boost::optional<response> parse_type(
parse_state &state, response &temp, u8 data)
{
temp.type = u8_to_type(data);
state = parse_state::name;
return {};
}
// ==========================================================================
// PARSE_IS_OR_INFO
// ==========================================================================
boost::optional<response> parse_is_or_info(
parse_state &state, response &temp, u8 data)
{
state = parse_state::type;
return {};
}
// ==========================================================================
// PARSE_DATA
// ==========================================================================
boost::optional<response> parse_data(
parse_state &state, response &temp, u8 data)
{
boost::optional<response> resp;
switch (state)
{
case parse_state::is_or_info :
resp = parse_is_or_info(state, temp, data);
break;
case parse_state::type :
resp = parse_type(state, temp, data);
break;
case parse_state::name :
resp = parse_name(state, temp, data);
break;
case parse_state::name_esc :
resp = parse_name_esc(state, temp, data);
break;
case parse_state::value :
resp = parse_value(state, temp, data);
break;
case parse_state::value_esc :
resp = parse_value_esc(state, temp, data);
break;
default :
return {};
break;
}
return resp;
}
}
// ==========================================================================
// PARSE_RESPONSES
// ==========================================================================
std::vector<response> parse_responses(telnetpp::u8stream const &stream)
{
std::vector<response> responses;
parse_state state = parse_state::is_or_info;
response temp;
boost::optional<response> resp;
for (auto const &data : stream)
{
resp = parse_data(state, temp, data);
if (resp)
{
responses.push_back(*resp);
}
}
if (!temp.name.empty())
{
responses.push_back(temp);
}
return responses;
}
}}}}
| 25.064815
| 77
| 0.447728
|
CalielOfSeptem
|
122982be704273bd3bce1d02296fba328b354a39
| 22,225
|
cpp
|
C++
|
monsters/monster.cpp
|
Snekoff/Another_DnD_simulator
|
8006f0585b25dbbb446ca3962f6938bc402d4831
|
[
"MIT"
] | null | null | null |
monsters/monster.cpp
|
Snekoff/Another_DnD_simulator
|
8006f0585b25dbbb446ca3962f6938bc402d4831
|
[
"MIT"
] | null | null | null |
monsters/monster.cpp
|
Snekoff/Another_DnD_simulator
|
8006f0585b25dbbb446ca3962f6938bc402d4831
|
[
"MIT"
] | null | null | null |
//
// MIT License
// Copyright (c) 2019 Snekoff. All rights reserved.
//
#include "monster.h"
using json = nlohmann::json;
Monster::Monster(Random_Generator_ *Rand_gen, int name_index, int challenge_rating_index) {
ifstream MonJson;
Existing_Monsters E_M;
E_M.fakeParameter = 1;
cout << "Control reach Monster::Constructor 0\n";
//MonJson.open("E:/Den`s/programming/Git_c++/Another_DnD_simulator/aditional_tools/5etools json/monsters/bestiary-all.json");
MonJson.open("../aditional_tools/5etools json/monsters/bestiary-all.json");
if (MonJson.is_open()) {
cout << "Control reach Monster::Constructor 1\n";
json MonsterJson = json::parse(MonJson);
saving_throws.resize(kAbilities_Num);
skillString.resize(kSkills_Num);
Str = 0;
Dex = 0;
Con = 0;
Int = 0;
Wis = 0;
Cha = 0;
armor_class = 0;
//!MonsterJson["monster"][i]["name"].empty()
for (int i = 0; MonsterJson["monster"][i].find("name") != MonsterJson["monster"][i].end(); i++) {
//Challenge rating unknown is challenge rating = 30
if(challenge_rating_index < 0 || challenge_rating_index > E_M.Challenge_rating.size() ||
name_index < 0 || name_index > E_M.Challenge_rating[challenge_rating_index].size()){
cout << "wrong challenge_rating_index or name_index in Monster.cpp Monster::Constructor\n";
break;
}
if (MonsterJson["monster"][i]["name"] == E_M.Challenge_rating[challenge_rating_index][name_index]) {
cout << "Control reach Monster::Constructor 2\n";
monster_name = commonStringParse(MonsterJson["monster"][i], "name");
auto endPointer = MonsterJson["monster"][i].end();
size = commonStringParse(MonsterJson["monster"][i], "size");
challenge_rating = commonStringParse(MonsterJson["monster"][i], "cr");
cout << "Control reach Monster::Constructor 3\n";
// maxhealth && formula
if (MonsterJson["monster"][i].find("hp") != endPointer) {
maxhealth = commonIntParse(MonsterJson["monster"][i]["hp"], "average");
if (maxhealth == 0) cout << "----->Monster::hp_average not found!\n";
if (MonsterJson["monster"][i]["hp"].find("formula") != MonsterJson["monster"][i]["hp"].end()) {
hp_formula = MonsterJson["monster"][i]["hp"]["formula"];
health_dice = Hp_Formula_Parse(hp_formula, 0);
health_dice_num = Hp_Formula_Parse(hp_formula, 1);
health_modifier = Hp_Formula_Parse(hp_formula, 2);
} else cout << "Monster hp_formula not found!\n";
}
cout << "Control reach Monster::Constructor 4\n";
//type
if (MonsterJson["monster"][i].find("type") != endPointer) {
type_s = commonStringParse(MonsterJson["monster"][i]["type"], "type");
if (!type_s.empty()) {
type_tags = commonVectorStringParse(MonsterJson["monster"][i]["type"], "tags");
} else type_s = commonStringParse(MonsterJson["monster"][i], "type");
}
cout << "Control reach Monster::Constructor 5\n";
alignment = commonVectorStringParse(MonsterJson["monster"][i], "alignment");
//ac
if (MonsterJson["monster"][i].find("ac") != endPointer) {
armor_class = commonIntParse(MonsterJson["monster"][i]["ac"][0], "ac");
if (armor_class < 0 || armor_class > 100) { armor_class = MonsterJson["monster"][i]["ac"]; }
else acFrom = commonVectorStringParse(MonsterJson["monster"][i]["ac"][0], "from");
}
cout << "Control reach Monster::Constructor 6\n";
// movement speed
// walk, swim, climb, fly
if (MonsterJson["monster"][i].find("speed") != endPointer) {
speed[3] = 0;
speed[0] = commonIntParse(MonsterJson["monster"][i]["speed"], "walk");
speed[1] = commonIntParse(MonsterJson["monster"][i]["speed"], "swim");;
speed[2] = commonIntParse(MonsterJson["monster"][i]["speed"], "climb");;
if (MonsterJson["monster"][i]["speed"].find("fly") != MonsterJson["monster"][i]["speed"].end()) {
speed[3] = commonIntParse(MonsterJson["monster"][i]["speed"]["fly"], "fly");
if (speed[3] == 0) { speed[3] = commonIntParse(MonsterJson["monster"][i]["speed"], "fly"); }
fly_condition = commonStringParse(MonsterJson["monster"][i]["speed"]["fly"], "condition");
can_hover = commonBoolParse(MonsterJson["monster"][i]["speed"], "can_hover");
}
}
cout << "Control reach Monster::Constructor 7\n";
//abilities
Str = commonIntParse(MonsterJson["monster"][i], "str");
Dex = commonIntParse(MonsterJson["monster"][i], "dex");
Con = commonIntParse(MonsterJson["monster"][i], "con");
Int = commonIntParse(MonsterJson["monster"][i], "int");
Wis = commonIntParse(MonsterJson["monster"][i], "wis");
Cha = commonIntParse(MonsterJson["monster"][i], "cha");
cout << "Control reach Monster::Constructor 7\n";
//saving throws
if (MonsterJson["monster"][i].find("save") != endPointer) {
saving_throws[0] = commonStringParse(MonsterJson["monster"][i]["save"], "str");
saving_throws[1] = commonStringParse(MonsterJson["monster"][i]["save"], "dex");
saving_throws[2] = commonStringParse(MonsterJson["monster"][i]["save"], "con");
saving_throws[3] = commonStringParse(MonsterJson["monster"][i]["save"], "int");
saving_throws[4] = commonStringParse(MonsterJson["monster"][i]["save"], "wis");
saving_throws[5] = commonStringParse(MonsterJson["monster"][i]["save"], "cha");
}
cout << "Control reach Monster::Constructor 8\n";
//skill
if (MonsterJson["monster"][i].find("skill") != endPointer) {
Existing_classes E_C;
for (int l = 0; l < kSkills_Num; l++) {
//skill_s = skill name
skillString[l] = commonStringParse(MonsterJson["monster"][i]["skill"], E_C.skills_s[l]);
}
}
cout << "Control reach Monster::Constructor 9\n";
//resistances
if (MonsterJson["monster"][i].find("resist") != endPointer) {
for (int j = 0; j < MonsterJson["monster"][i]["resist"].size(); j++) {
if (MonsterJson["monster"][i]["resist"][j].size() == 1) {
resistance.push_back(MonsterJson["monster"][i]["resist"][j]);
} else if (MonsterJson["monster"][i]["resist"][j].find("resist") != MonsterJson["monster"][i]["resist"][j].end()) {
for (int m = 0; m < MonsterJson["monster"][i]["resist"][j]["resist"].size(); m++) {
resistance.push_back(MonsterJson["monster"][i]["resist"][j]["resist"][m]);
}
if (MonsterJson["monster"][i]["resist"][j].find("note") != MonsterJson["monster"][i]["resist"][j].end()) {
if(MonsterJson["monster"][i]["resist"][j]["note"].is_string()) resistance_note.push_back(MonsterJson["monster"][i]["resist"][j]["note"]);
else for (int m = 0; m < MonsterJson["monster"][i]["resist"][j]["note"].size(); m++) {
resistance_note.push_back(MonsterJson["monster"][i]["resist"][j]["note"][m]);
}
}
}
}
}
cout << "Control reach Monster::Constructor 11\n";
//others
passive_perception = commonIntParse(MonsterJson["monster"][i], "passive");
cout << "Control reach Monster::Constructor 11_1\n";
immune = ImmuneParse(MonsterJson["monster"][i], "immune");
cout << "Control reach Monster::Constructor 11_1_1\n";
condition_imune =
commonForImmuneAndConditionImmuneAndSensesAndLanguageParse(MonsterJson["monster"][i], "conditionImmune");
cout << "Control reach Monster::Constructor 11_1_2\n";
senses = commonForImmuneAndConditionImmuneAndSensesAndLanguageParse(MonsterJson["monster"][i], "senses");
cout << "Control reach Monster::Constructor 11_2\n";
languages = commonForImmuneAndConditionImmuneAndSensesAndLanguageParse(MonsterJson["monster"][i], "languages");
trait =
commonForTraitAndActionAndSpellNameAndSpellHeaderEntriesAndLegendaryParse(MonsterJson["monster"][i]["trait"],
"entries");
cout << "Control reach Monster::Constructor 11_3\n";
action =
commonForTraitAndActionAndSpellNameAndSpellHeaderEntriesAndLegendaryParse(MonsterJson["monster"][i]["action"],
"entries");
cout << "Control reach Monster::Constructor 11_4\n";
legendary =
commonForTraitAndActionAndSpellNameAndSpellHeaderEntriesAndLegendaryParse(MonsterJson["monster"][i]["legendary"],
"entries");
cout << "Control reach Monster::Constructor 11_5\n";
spellcasting_name_and_entries = commonForTraitAndActionAndSpellNameAndSpellHeaderEntriesAndLegendaryParse(
MonsterJson["monster"][i]["spellcasting"], "headerEntries");
cout << "Control reach Monster::Constructor 12\n";
spellcasting_will = commonVectorStringParse(MonsterJson["monster"][i]["spellcasting"], "will");
spellcast_daily = spellcastingDailyParse(MonsterJson["monster"][i]["spellcasting"]);
spells = spellsParse(MonsterJson["monster"][i], "spells");
spellSlots = spellSlotsParse(MonsterJson["monster"][i], "spells"); //TEST
is_named_creature = commonBoolParse(MonsterJson["monster"][i], "is_named_creature");
cout << "Control reach Monster::Constructor b_13\n";
trait_tags = commonVectorStringParse(MonsterJson["monster"][i], "trait_tags");
cout << "Control reach Monster::Constructor 13\n";
action_tags = commonVectorStringParse(MonsterJson["monster"][i], "action_tags");
cout << "Control reach Monster::Constructor 14\n";
language_tags = commonVectorStringParse(MonsterJson["monster"][i], "language_tags");
cout << "Control reach Monster::Constructor 15\n";
sense_tags = commonVectorStringParse(MonsterJson["monster"][i], "sense_tags");
cout << "Control reach Monster::Constructor 16\n";
legendary_group = commonStringParse(MonsterJson["monster"][i], "legendary_group");
legendary_actions = commonIntParse(MonsterJson["monster"][i], "legendary_actions");
// "" - not needed
variant = commonVariantParse(MonsterJson["monster"][i], "variant");
maxhealth = health_modifier + HealthRoll(Rand_gen, health_dice, health_dice_num);
health = maxhealth;
StrModifier = AbilityModifier(Str);
DexModifier = AbilityModifier(Dex);
ConModifier = AbilityModifier(Con);
IntModifier = AbilityModifier(Int);
WisModifier = AbilityModifier(Wis);
ChaModifier = AbilityModifier(Cha);
break;
} /*else cout << "monster not found in json\n";*/
}
} else cout << "error loading MonJson" << endl;
cout << "Control reach Monster::Constructor 9\n";
}
Monster::Monster() = default;
Monster::Monster(Random_Generator_ *Rand_gen, const Monster &another) {
saving_throws.resize(kAbilities_Num);
skillString.resize(kSkills_Num);
monster_name = another.monster_name;
size = another.size;
challenge_rating = another.challenge_rating;
maxhealth = another.maxhealth;
health = another.health;
hp_formula = another.hp_formula;
health_dice = another.health_dice;
health_dice_num = another.health_dice_num;
health_modifier = another.health_modifier;
type_s = another.type_s;
type_tags = another.type_tags;
alignment = another.alignment;
armor_class = another.armor_class;
acFrom = another.acFrom;
for (int i = 0; i < kSpeed_types_NUM; i++) {
speed[i] = another.speed[i];
}
fly_condition = another.fly_condition;
can_hover = another.can_hover;
Str = another.Str;
Dex = another.Dex;
Con = another.Con;
Int = another.Int;
Wis = another.Wis;
Cha = another.Cha;
for (int i = 0; i < kAbilities_Num; i++) {
saving_throws[i] = another.saving_throws[i];
}
for (int i = 0; i < kSkills_Num; i++) {
skillString[i] = another.skillString[i];
}
resistance = another.resistance;
resistance_note = another.resistance_note;
passive_perception = another.passive_perception;
immune = another.immune;
condition_imune = another.condition_imune;
senses = another.senses;
languages = another.languages;
trait = another.trait;
action = another.action;
legendary = another.legendary;
spellcasting_name_and_entries = another.spellcasting_name_and_entries;
spellcasting_will = another.spellcasting_will;
spellcast_daily = another.spellcast_daily;
is_named_creature = another.is_named_creature;
trait_tags = another.trait_tags;
action_tags = another.action_tags;
language_tags = another.language_tags;
sense_tags = another.sense_tags;
legendary_group = another.legendary_group;
legendary_actions = another.legendary_actions;
variant = another.variant;
maxhealth = health_modifier + HealthRoll(Rand_gen, health_dice, health_dice_num);
health = maxhealth;
StrModifier = AbilityModifier(Str);
DexModifier = AbilityModifier(Dex);
ConModifier = AbilityModifier(Con);
IntModifier = AbilityModifier(Int);
WisModifier = AbilityModifier(Wis);
ChaModifier = AbilityModifier(Cha);
}
/*Monster::Monster(int type_, int level_, int hp, int armor_class_) {
}*/
Monster::~Monster() = default;
int Monster::GetInt(int whatToShow) {
if (whatToShow == 0) return maxhealth;
else if (whatToShow == 1) return health;
else if (whatToShow == 2) return health_dice;
else if (whatToShow == 3) return health_dice_num;
else if (whatToShow == 4) return health_modifier;
else if (whatToShow == 5) return armor_class;
else if (whatToShow == 6) return speed[kSpeed_types_NUM - 4]; // walk
else if (whatToShow == 7) return speed[kSpeed_types_NUM - 3];
else if (whatToShow == 8) return speed[kSpeed_types_NUM - 2];
else if (whatToShow == 9) return speed[kSpeed_types_NUM - 1]; // fly
else if (whatToShow == 10) return Str;
else if (whatToShow == 11) return Dex;
else if (whatToShow == 12) return Con;
else if (whatToShow == 13) return Int;
else if (whatToShow == 14) return Wis;
else if (whatToShow == 15) return Cha;
else if (whatToShow == 16) return passive_perception;
else if (whatToShow == 17) return legendary_actions;
return -1;
}
string Monster::GetString(int whatToShow) {
if (whatToShow == 0) return monster_name;
else if (whatToShow == 1) return size;
else if (whatToShow == 2) return challenge_rating;
else if (whatToShow == 3) return hp_formula;
else if (whatToShow == 4) return type_s;
else if (whatToShow == 5) return fly_condition;
else if (whatToShow >= 6 && whatToShow < 6 + kAbilities_Num) return saving_throws[whatToShow - 6];
else if (whatToShow >= 12 && whatToShow < 12 + kSkills_Num) return skillString[whatToShow - 12];
else if (whatToShow == 30) return legendary_group;
return "";
}
vector<string> Monster::GetVectorString(int whatToShow) {
vector<string> Output;
if (whatToShow == 0) return type_tags;
else if (whatToShow == 1) return alignment;
else if (whatToShow == 2) return acFrom;
else if (whatToShow == 3) return resistance;
else if (whatToShow == 4) return resistance_note;
else if (whatToShow == 5) return immune;
else if (whatToShow == 6) return condition_imune;
else if (whatToShow == 7) return senses;
else if (whatToShow == 8) return languages;
else if (whatToShow == 9) return trait;
else if (whatToShow == 10) return action;
else if (whatToShow == 11) return legendary;
else if (whatToShow == 12) return spellcasting_name_and_entries;
else if (whatToShow == 13) return spellcasting_will;
else if (whatToShow == 14) return trait_tags;
else if (whatToShow == 15) return action_tags;
else if (whatToShow == 16) return language_tags;
else if (whatToShow == 17) return sense_tags;
else if (whatToShow == 18) return variant;
return Output;
}
bool Monster::GetBool(int whatToShow) {
if (whatToShow == 0) return can_hover;
else if (whatToShow == 1) return is_named_creature;
/*else if (whatToShow == 2) return;
else if (whatToShow == 3) return;
else if (whatToShow == 4) return;
else if (whatToShow == 5) return;
else if (whatToShow == 6) return;
else if (whatToShow == 7) return;
else if (whatToShow == 8) return;
else if (whatToShow == 9) return;*/
return false;
}
vector<SpellAndUsageTimes> Monster::GetSpellAndUsageTimes(int whatToShow) {
vector<SpellAndUsageTimes> Output;
if (whatToShow == 0) return spellcast_daily;
return Output;
}
void Monster::SetInt(int whatToSet, int value) {
if (whatToSet == 0) maxhealth = value;
else if (whatToSet == 1) health = value;
else if (whatToSet == 2) health_dice = value;
else if (whatToSet == 3) health_dice_num = value;
else if (whatToSet == 4) health_modifier = value;
else if (whatToSet == 5) armor_class = value;
else if (whatToSet == 6) speed[kSpeed_types_NUM - 4] = value; // walk
else if (whatToSet == 7) speed[kSpeed_types_NUM - 3] = value;
else if (whatToSet == 8) speed[kSpeed_types_NUM - 2] = value;
else if (whatToSet == 9) speed[kSpeed_types_NUM - 1] = value; // fly
else if (whatToSet == 10) Str = value;
else if (whatToSet == 11) Dex = value;
else if (whatToSet == 12) Con = value;
else if (whatToSet == 13) Int = value;
else if (whatToSet == 14) Wis = value;
else if (whatToSet == 15) Cha = value;
else if (whatToSet == 16) passive_perception = value;
else if (whatToSet == 17) legendary_actions = value;
}
void Monster::SetString(int whatToSet, string value) {
if (whatToSet == 0) monster_name = value;
else if (whatToSet == 1) size = value;
else if (whatToSet == 2) challenge_rating = value;
else if (whatToSet == 3) hp_formula = value;
else if (whatToSet == 4) type_s = value;
else if (whatToSet == 5) fly_condition = value;
else if (whatToSet >= 6 && whatToSet < 6 + kAbilities_Num) saving_throws[whatToSet - 6] = value;
else if (whatToSet >= 12 && whatToSet < 12 + kSkills_Num) skillString[whatToSet - 12] = value;
else if (whatToSet == 30) legendary_group = value;
}
void Monster::SetVectorString(int whatToSet, vector<string> value) {
if (whatToSet == 0) type_tags = value;
else if (whatToSet == 1) alignment = value;
else if (whatToSet == 2) acFrom = value;
else if (whatToSet == 3) resistance = value;
else if (whatToSet == 4) resistance_note = value;
else if (whatToSet == 5) immune = value;
else if (whatToSet == 6) condition_imune = value;
else if (whatToSet == 7) senses = value;
else if (whatToSet == 8) languages = value;
else if (whatToSet == 9) trait = value;
else if (whatToSet == 10) action = value;
else if (whatToSet == 11) legendary = value;
else if (whatToSet == 12) spellcasting_name_and_entries = value;
else if (whatToSet == 13) spellcasting_will = value;
else if (whatToSet == 14) trait_tags = value;
else if (whatToSet == 15) action_tags = value;
else if (whatToSet == 16) language_tags = value;
else if (whatToSet == 17) sense_tags = value;
else if (whatToSet == 18) variant = value;
}
void Monster::SetBool(int whatToSet, bool value) {
if (whatToSet == 0) can_hover = value;
else if (whatToSet == 1) is_named_creature = value;
}
void Monster::SetSpellAndUsageTimes(int whatToSet, vector<SpellAndUsageTimes> &value) {
if (whatToSet == 0) spellcast_daily = value;
}
const nlohmann::basic_json<> Monster::Save() {
json Output;
Monster_Parameters_Names M_P;
M_P.fakeParameter = 1;
cout << "Control reach Monster::Save 1\n";
for (int i = 0; i < M_P.intVar.size(); i++) {
Output["monster"] += json::object_t::value_type(M_P.intVar[i], this->GetInt(i));
}
for (int i = 0; i < M_P.boolVar.size(); i++) {
Output["monster"] += json::object_t::value_type(M_P.boolVar[i], this->GetBool(i));
}
cout << "Control reach Monster::Save 3\n";
for (int i = 0; i < M_P.stringVar.size(); i++) {
Output["monster"] += json::object_t::value_type(M_P.stringVar[i], this->GetString(i));
}
cout << "Control reach Monster::Save 4\n";
for (int i = 0; i < M_P.vectorStringVar.size(); i++) {
Output["monster"] += json::object_t::value_type(M_P.vectorStringVar[i], this->GetVectorString(i));
}
cout << "Control reach Monster::Save 5\n";
Output["monster"] += json::object_t::value_type("dailySpells", NULL);
for (int i = 0; i < spellcast_daily.size(); i++) {
//Output["monster"]["dailySpells"] += json::object_t::value_type(i, NULL);
Output["monster"]["dailySpells"][i] += json::object_t::value_type("name" , spellcast_daily[i].spell_name);
Output["monster"]["dailySpells"][i] +=
json::object_t::value_type("max_charges", to_string(spellcast_daily[i].max_charges));
Output["monster"]["dailySpells"][i] += json::object_t::value_type("charges", to_string(spellcast_daily[i].charges));
}
cout << "Control reach Monster::Save 10\n";
return Output;
}
//j["monster"] must be given as a parameter
bool Monster::Load(const nlohmann::basic_json<> &j) {
Monster_Parameters_Names M_P;
if(j.find("monster_name") == j.end()) return false;
for (int i = 0; i < M_P.intVar.size(); i++) {
SetInt(i, j[M_P.intVar[i]]);
}
for (int i = 0; i < M_P.boolVar.size(); i++) {
SetInt(i, j[M_P.boolVar[i]]);
}
for (int i = 0; i < M_P.stringVar.size(); i++) {
SetInt(i, j[M_P.stringVar[i]]);
}
for (int i = 0; i < M_P.vectorStringVar.size(); i++) {
SetInt(i, j[M_P.vectorStringVar[i]]);
}
if(j.find("dailySpells") == j.end()) return true;
vector <SpellAndUsageTimes> spellAndUsage_;
for(int i = 0; i < j["dailySpells"].size(); i++){
SpellAndUsageTimes daily;
daily.spell_name = j["dailySpells"]["name"];
daily.max_charges = j["dailySpells"]["max_charges"];
daily.charges = j["dailySpells"]["charges"];
spellAndUsage_.push_back(daily);
}
SetSpellAndUsageTimes(0, spellAndUsage_);
return true;
}
| 47.693133
| 153
| 0.647649
|
Snekoff
|
122c583a196b4c2f98a6b503a1b831db87401658
| 9,386
|
cpp
|
C++
|
OcularCore/src/Renderer/Window/WindowManager.cpp
|
ssell/OcularEngine
|
c80cc4fcdb7dd7ce48d3af330bd33d05312076b1
|
[
"Apache-2.0"
] | 8
|
2017-01-27T01:06:06.000Z
|
2020-11-05T20:23:19.000Z
|
OcularCore/src/Renderer/Window/WindowManager.cpp
|
ssell/OcularEngine
|
c80cc4fcdb7dd7ce48d3af330bd33d05312076b1
|
[
"Apache-2.0"
] | 39
|
2016-06-03T02:00:36.000Z
|
2017-03-19T17:47:39.000Z
|
OcularCore/src/Renderer/Window/WindowManager.cpp
|
ssell/OcularEngine
|
c80cc4fcdb7dd7ce48d3af330bd33d05312076b1
|
[
"Apache-2.0"
] | 4
|
2019-05-22T09:13:36.000Z
|
2020-12-01T03:17:45.000Z
|
/**
* Copyright 2014-2017 Steven T Sell (ssell@vertexfragment.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Renderer\Window\Window.hpp"
#include "Renderer\Window\WindowWin32.hpp"
#include "Exceptions/Exception.hpp"
#include "OcularEngine.hpp"
#include <iostream>
//------------------------------------------------------------------------------------------
namespace Ocular
{
namespace Core
{
//----------------------------------------------------------------------------------
// CONSTRUCTORS
//----------------------------------------------------------------------------------
WindowManager::WindowManager()
{
m_MainWindow = nullptr;
}
WindowManager::~WindowManager()
{
closeAllWindows();
}
//----------------------------------------------------------------------------------
// PUBLIC METHODS
//----------------------------------------------------------------------------------
std::shared_ptr<AWindow> WindowManager::openWindow(WindowDescriptor const& descriptor)
{
#ifdef OCULAR_WINDOWS
return openWindowWin32(descriptor);
#elif OCULAR_OSX
return openWindowOSX(descriptor);
#elif OCULAR_LINUX
return openWindowLinux(descriptor);
#endif
}
std::shared_ptr<AWindow> WindowManager::connectWindow(WindowDescriptor const& descriptor, void* windowID)
{
#ifdef OCULAR_WINDOWS
return connectWindowWin32(descriptor, windowID);
#elif OCULAR_OSX
return connectWindowOSX(descriptor, windowID);
#elif OCULAR_LINUX
return connectWindowLinux(descriptor, windowID);
#endif
}
void WindowManager::closeWindow(UUID const& uuid)
{
bool needNewMainWindow = false;
if((m_MainWindow != nullptr) && (m_MainWindow->getUUID() == uuid))
{
// We are deleting the main window, set it to next available window when done
needNewMainWindow = true;
}
//----------------------------------------
for(auto iter = m_Windows.begin(); iter != m_Windows.end(); ++iter)
{
if((*iter)->getUUID() == uuid)
{
//--------------------------------
// Close, release, and stop tracking the window
try
{
(*iter).get()->close();
}
catch(Exception e)
{
OcularEngine.Logger()->error(e);
}
(*iter) = nullptr;
m_Windows.erase(iter);
break;
}
}
//----------------------------------------
if(needNewMainWindow)
{
if(m_Windows.size() > 0)
{
m_MainWindow = m_Windows.front();
}
else
{
m_MainWindow = nullptr;
}
}
}
void WindowManager::closeAllWindows()
{
while(m_Windows.size() > 0)
{
closeWindow(m_Windows.front()->getUUID());
}
}
std::list<std::shared_ptr<AWindow>> WindowManager::listWindows() const
{
return m_Windows;
}
uint32_t WindowManager::getNumWindows() const
{
return static_cast<uint32_t>(m_Windows.size());
}
std::shared_ptr<AWindow> WindowManager::getWindow(UUID const& uuid)
{
std::shared_ptr<AWindow> result = nullptr;
for(auto iter = m_Windows.begin(); iter != m_Windows.end(); ++iter)
{
if((*iter))
{
if((*iter)->getUUID() == uuid)
{
result = (*iter);
break;
}
}
}
return result;
}
std::shared_ptr<AWindow> WindowManager::getWindow(void* osPointer)
{
std::shared_ptr<AWindow> result = nullptr;
for(auto iter = m_Windows.begin(); iter != m_Windows.end(); ++iter)
{
if((*iter)->getOSPointer() == osPointer)
{
result = (*iter);
break;
}
}
return result;
}
std::shared_ptr<AWindow> WindowManager::getMainWindow()
{
return m_MainWindow;
}
void WindowManager::setMainWindow(UUID const& uuid)
{
m_MainWindow = getWindow(uuid);
}
void WindowManager::updateWindows(int64_t time)
{
for(auto iter = m_Windows.begin(); iter != m_Windows.end(); ++iter)
{
(*iter)->update(time);
}
}
//----------------------------------------------------------------------------------
// PROTECTED METHODS
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// PRIVATE METHODS
//----------------------------------------------------------------------------------
std::shared_ptr<AWindow> WindowManager::openWindowWin32(WindowDescriptor const& descriptor)
{
std::shared_ptr<AWindow> result;
#ifdef OCULAR_WINDOWS
try
{
m_Windows.push_front(std::make_shared<WindowWin32>(descriptor));
result = m_Windows.front();
if(result != nullptr)
{
result->open();
if(m_MainWindow == nullptr)
{
m_MainWindow = result;
}
}
}
catch(Exception& e)
{
OcularEngine.Logger()->error(e);
}
#endif
return result;
}
std::shared_ptr<AWindow> WindowManager::openWindowOSX(WindowDescriptor const& descriptor)
{
std::shared_ptr<AWindow> result = nullptr;
#ifdef OCULAR_OSX
try
{
m_Windows.push_front(std::make_unique<Window>(WindowOSX(descriptor)));
result = m_Windows.front().get();
if(m_MainWindow == nullptr)
{
m_MainWindow = result;
}
}
catch(Exception& e)
{
OcularEngine.Logger()->error(e);
}
#endif
return result;
}
std::shared_ptr<AWindow> WindowManager::openWindowLinux(WindowDescriptor const& descriptor)
{
std::shared_ptr<AWindow> result = nullptr;
#ifdef OCULAR_LINUX
try
{
m_Windows.push_front(std::make_unique<Window>(WindowLinux(descriptor)));
result = m_Windows.front().get();
if(m_MainWindow == nullptr)
{
m_MainWindow = result;
}
}
catch(Exception& e)
{
OcularEngine.Logger()->error(e);
}
#endif
return result;
}
std::shared_ptr<AWindow> WindowManager::connectWindowWin32(WindowDescriptor const& descriptor, void* windowID)
{
std::shared_ptr<AWindow> result;
#ifdef OCULAR_WINDOWS
try
{
m_Windows.push_front(std::make_shared<WindowWin32>(descriptor, windowID));
result = m_Windows.front();
if(result != nullptr)
{
result->open();
if(m_MainWindow == nullptr)
{
m_MainWindow = result;
}
}
}
catch(Exception& e)
{
OcularEngine.Logger()->error(e);
}
#endif
return result;
}
std::shared_ptr<AWindow> WindowManager::connectWindowOSX(WindowDescriptor const& descriptor, void* windowID)
{
std::shared_ptr<AWindow> result = nullptr;
#ifdef OCULAR_OSX
#endif
return result;
}
std::shared_ptr<AWindow> WindowManager::connectWindowLinux(WindowDescriptor const& descriptor, void* windowID)
{
std::shared_ptr<AWindow> result = nullptr;
#ifdef OCULAR_LINUX
#endif
return result;
}
}
}
| 28.703364
| 118
| 0.441509
|
ssell
|
122cca8aaf6efe1eef38798071498e849d87bd69
| 193
|
cpp
|
C++
|
src/main/main.cpp
|
modeco80/ps2-cpp20-primer
|
47db939c20e7f189ee8018ef2b767bdf66f37213
|
[
"MIT"
] | null | null | null |
src/main/main.cpp
|
modeco80/ps2-cpp20-primer
|
47db939c20e7f189ee8018ef2b767bdf66f37213
|
[
"MIT"
] | null | null | null |
src/main/main.cpp
|
modeco80/ps2-cpp20-primer
|
47db939c20e7f189ee8018ef2b767bdf66f37213
|
[
"MIT"
] | null | null | null |
/**
* PS2 C++20 Primer
*
* (C) 2022 Lily/modeco80 <lily.modeco80@protonmail.ch>
* under the terms of the MIT license.
*/
#include <stdio.h>
int main() {
printf("Hello PS2 World!\n");
}
| 14.846154
| 55
| 0.626943
|
modeco80
|
122eaeb57d07396885dd15b462fbc77d5a91b636
| 67,902
|
hpp
|
C++
|
include/outcome/basic_outcome.hpp
|
libbboze/outcome
|
248b05f75c723df56a5fa7988bb7de8b173a98ba
|
[
"Apache-2.0"
] | null | null | null |
include/outcome/basic_outcome.hpp
|
libbboze/outcome
|
248b05f75c723df56a5fa7988bb7de8b173a98ba
|
[
"Apache-2.0"
] | null | null | null |
include/outcome/basic_outcome.hpp
|
libbboze/outcome
|
248b05f75c723df56a5fa7988bb7de8b173a98ba
|
[
"Apache-2.0"
] | null | null | null |
/* A less simple result type
(C) 2017 Niall Douglas <http://www.nedproductions.biz/> (59 commits)
File Created: June 2017
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License in the accompanying file
Licence.txt or at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file Licence.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef OUTCOME_BASIC_OUTCOME_HPP
#define OUTCOME_BASIC_OUTCOME_HPP
#include "config.hpp"
#include "basic_result.hpp"
#include "detail/basic_outcome_exception_observers.hpp"
#include "detail/basic_outcome_failure_observers.hpp"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation" // Standardese markup confuses clang
#endif
OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
template <class R, class S, class P, class NoValuePolicy> //
OUTCOME_REQUIRES(trait::type_can_be_used_in_basic_result<P> && (std::is_void<P>::value || std::is_default_constructible<P>::value)) //
class basic_outcome;
namespace detail
{
// May be reused by basic_outcome subclasses to save load on the compiler
template <class value_type, class error_type, class exception_type> struct outcome_predicates
{
using result = result_predicates<value_type, error_type>;
// Predicate for the implicit constructors to be available
static constexpr bool implicit_constructors_enabled = //
result::implicit_constructors_enabled //
&& !detail::is_implicitly_constructible<value_type, exception_type> //
&& !detail::is_implicitly_constructible<error_type, exception_type> //
&& !detail::is_implicitly_constructible<exception_type, value_type> //
&& !detail::is_implicitly_constructible<exception_type, error_type>;
// Predicate for the value converting constructor to be available.
template <class T>
static constexpr bool enable_value_converting_constructor = //
implicit_constructors_enabled //
&&result::template enable_value_converting_constructor<T> //
&& !detail::is_implicitly_constructible<exception_type, T>; // deliberately less tolerant of ambiguity than result's edition
// Predicate for the error converting constructor to be available.
template <class T>
static constexpr bool enable_error_converting_constructor = //
implicit_constructors_enabled //
&&result::template enable_error_converting_constructor<T> //
&& !detail::is_implicitly_constructible<exception_type, T>; // deliberately less tolerant of ambiguity than result's edition
// Predicate for the error condition converting constructor to be available.
template <class ErrorCondEnum>
static constexpr bool enable_error_condition_converting_constructor = result::template enable_error_condition_converting_constructor<ErrorCondEnum> //
&& !detail::is_implicitly_constructible<exception_type, ErrorCondEnum>;
// Predicate for the exception converting constructor to be available.
template <class T>
static constexpr bool enable_exception_converting_constructor = //
implicit_constructors_enabled //
&& !is_in_place_type_t<std::decay_t<T>>::value // not in place construction
&& !detail::is_implicitly_constructible<value_type, T> && !detail::is_implicitly_constructible<error_type, T> && detail::is_implicitly_constructible<exception_type, T>;
// Predicate for the error + exception converting constructor to be available.
template <class T, class U>
static constexpr bool enable_error_exception_converting_constructor = //
implicit_constructors_enabled //
&& !is_in_place_type_t<std::decay_t<T>>::value // not in place construction
&& !detail::is_implicitly_constructible<value_type, T> && detail::is_implicitly_constructible<error_type, T> //
&& !detail::is_implicitly_constructible<value_type, U> && detail::is_implicitly_constructible<exception_type, U>;
// Predicate for the converting copy constructor from a compatible outcome to be available.
template <class T, class U, class V, class W>
static constexpr bool enable_compatible_conversion = //
(std::is_void<T>::value || detail::is_explicitly_constructible<value_type, typename basic_outcome<T, U, V, W>::value_type>) // if our value types are constructible
&&(std::is_void<U>::value || detail::is_explicitly_constructible<error_type, typename basic_outcome<T, U, V, W>::error_type>) // if our error types are constructible
&&(std::is_void<V>::value || detail::is_explicitly_constructible<exception_type, typename basic_outcome<T, U, V, W>::exception_type>) // if our exception types are constructible
;
// Predicate for the implicit converting inplace constructor from a compatible input to be available.
struct disable_inplace_value_error_exception_constructor;
template <class... Args>
using choose_inplace_value_error_exception_constructor = std::conditional_t< //
((static_cast<int>(std::is_constructible<value_type, Args...>::value) + static_cast<int>(std::is_constructible<error_type, Args...>::value) + static_cast<int>(std::is_constructible<exception_type, Args...>::value)) > 1), //
disable_inplace_value_error_exception_constructor, //
std::conditional_t< //
std::is_constructible<value_type, Args...>::value, //
value_type, //
std::conditional_t< //
std::is_constructible<error_type, Args...>::value, //
error_type, //
std::conditional_t< //
std::is_constructible<exception_type, Args...>::value, //
exception_type, //
disable_inplace_value_error_exception_constructor>>>>;
template <class... Args>
static constexpr bool enable_inplace_value_error_exception_constructor = //
implicit_constructors_enabled && !std::is_same<choose_inplace_value_error_exception_constructor<Args...>, disable_inplace_value_error_exception_constructor>::value;
};
// Select whether to use basic_outcome_failure_observers or not
template <class Base, class R, class S, class P, class NoValuePolicy>
using select_basic_outcome_failure_observers = //
std::conditional_t<trait::is_error_code_available<S>::value && trait::is_exception_ptr_available<P>::value, basic_outcome_failure_observers<Base, R, S, P, NoValuePolicy>, Base>;
template <class T, class U, class V> constexpr inline const V &extract_exception_from_failure(const failure_type<U, V> &v) { return v.exception(); }
template <class T, class U, class V> constexpr inline V &&extract_exception_from_failure(failure_type<U, V> &&v) { return static_cast<failure_type<U, V> &&>(v).exception(); }
template <class T, class U> constexpr inline const U &extract_exception_from_failure(const failure_type<U, void> &v) { return v.error(); }
template <class T, class U> constexpr inline U &&extract_exception_from_failure(failure_type<U, void> &&v) { return static_cast<failure_type<U, void> &&>(v).error(); }
template <class T> struct is_basic_outcome
{
static constexpr bool value = false;
};
template <class R, class S, class T, class N> struct is_basic_outcome<basic_outcome<R, S, T, N>>
{
static constexpr bool value = true;
};
} // namespace detail
//! True if an outcome
template <class T> using is_basic_outcome = detail::is_basic_outcome<std::decay_t<T>>;
//! True if an outcome
template <class T> static constexpr bool is_basic_outcome_v = detail::is_basic_outcome<std::decay_t<T>>::value;
namespace hooks
{
/*! The default instantiation hook implementation called when a `outcome` is first created
by conversion from one of its possible types. Does nothing.
\param 1 Some `outcome<...>` being constructed.
\param 2 The source data.
WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!
*/
template <class T, class... U> constexpr inline void hook_outcome_construction(T * /*unused*/, U &&... /*unused*/) noexcept {}
/*! The default instantiation hook implementation called when a `outcome` is created by copying
from another `outcome` or `result`. Does nothing.
\param 1 Some `outcome<...>` being constructed.
\param 2 The source data.
WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!
*/
template <class T, class U> constexpr inline void hook_outcome_copy_construction(T * /*unused*/, U && /*unused*/) noexcept {}
/*! The default instantiation hook implementation called when a `outcome` is created by moving
from another `outcome` or `result`. Does nothing.
\param 1 Some `outcome<...>` being constructed.
\param 2 The source data.
WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!
*/
template <class T, class U> constexpr inline void hook_outcome_move_construction(T * /*unused*/, U && /*unused*/) noexcept {}
/*! The default instantiation hook implementation called when a `outcome` is created by in place
construction. Does nothing.
\param 1 Some `outcome<...>` being constructed.
\param 2 The type of in place construction occurring.
\param 3 The source data.
WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!
*/
template <class T, class U, class... Args> constexpr inline void hook_outcome_in_place_construction(T * /*unused*/, in_place_type_t<U> /*unused*/, Args &&... /*unused*/) noexcept {}
//! Used in hook implementations to override the exception to something other than what was constructed.
template <class R, class S, class P, class NoValuePolicy, class U> constexpr inline void override_outcome_exception(basic_outcome<R, S, P, NoValuePolicy> *o, U &&v) noexcept;
} // namespace hooks
/*! Used to return from functions one of (i) a successful value (ii) a cause of failure (ii) a different cause of failure. `constexpr` capable.
\tparam R The optional type of the successful result (use `void` to disable). Cannot be a reference, a `in_place_type_t<>`, `success<>`, `failure<>`, an array, a function or non-destructible.
\tparam S The optional type of the first failure result (use `void` to disable). Must be either `void` or `DefaultConstructible`. Cannot be a reference, a `in_place_type_t<>`, `success<>`, `failure<>`, an array, a function or non-destructible.
\tparam P The optional type of the second failure result (use `void` to disable). Must be either `void` or `DefaultConstructible`. Cannot be a reference, a `in_place_type_t<>`, `success<>`, `failure<>`, an array, a function or non-destructible.
\tparam NoValuePolicy Policy on how to interpret types `S` and `P` when a wide observation of a not present value occurs.
This is an extension of `basic_result<R, S>` and it allows an alternative failure to be stored of type `P`, which can be observed
with the member functions `.exception()` and `.assume_exception()`. The `P` state takes precedence during no-value observation
over any `S` state, and it is possible to store `S + P` simultaneously such that `basic_outcome` could have any one the states:
1. `R` (`value_type`)
2. `S` (`error_type`)
3. `P` (`exception_type`)
4. `S + P` (`error_type + exception_type`)
*/
template <class R, class S, class P, class NoValuePolicy> //
OUTCOME_REQUIRES(trait::type_can_be_used_in_basic_result<P> && (std::is_void<P>::value || std::is_default_constructible<P>::value)) //
class OUTCOME_NODISCARD basic_outcome
#if defined(DOXYGEN_IS_IN_THE_HOUSE) || defined(STANDARDESE_IS_IN_THE_HOUSE)
: public detail::basic_outcome_failure_observers<detail::basic_result_final<R, S, P, NoValuePolicy>, R, S, P, NoValuePolicy>,
public detail::basic_outcome_exception_observers<detail::basic_result_final<R, S, NoValuePolicy>, R, S, P, NoValuePolicy>,
public detail::basic_result_final<R, S, NoValuePolicy>
#else
: public detail::select_basic_outcome_failure_observers<detail::basic_outcome_exception_observers<detail::basic_result_final<R, S, NoValuePolicy>, R, S, P, NoValuePolicy>, R, S, P, NoValuePolicy>
#endif
{
static_assert(trait::type_can_be_used_in_basic_result<P>, "The exception_type cannot be used");
static_assert(std::is_void<P>::value || std::is_default_constructible<P>::value, "exception_type must be void or default constructible");
using base = detail::select_basic_outcome_failure_observers<detail::basic_outcome_exception_observers<detail::basic_result_final<R, S, NoValuePolicy>, R, S, P, NoValuePolicy>, R, S, P, NoValuePolicy>;
friend struct policy::base;
template <class T, class U, class V, class W> friend class basic_outcome;
template <class T, class U, class V, class W, class X> friend constexpr inline void hooks::override_outcome_exception(basic_outcome<T, U, V, W> *o, X &&v) noexcept; // NOLINT
struct implicit_constructors_disabled_tag
{
};
struct value_converting_constructor_tag
{
};
struct error_converting_constructor_tag
{
};
struct error_condition_converting_constructor_tag
{
};
struct exception_converting_constructor_tag
{
};
struct error_exception_converting_constructor_tag
{
};
struct explicit_valueorerror_converting_constructor_tag
{
};
struct error_failure_tag
{
};
struct exception_failure_tag
{
};
struct disable_in_place_value_type
{
};
struct disable_in_place_error_type
{
};
struct disable_in_place_exception_type
{
};
public:
/// \output_section Member types
//! The success type.
using value_type = R;
//! The failure type.
using error_type = S;
//! The exception type
using exception_type = P;
//! Used to rebind this outcome to a different outcome type
template <class T, class U = S, class V = P, class W = NoValuePolicy> using rebind = basic_outcome<T, U, V, W>;
protected:
//! Requirement predicates for outcome.
struct predicate
{
using base = detail::outcome_predicates<value_type, error_type, exception_type>;
// Predicate for any constructors to be available at all
static constexpr bool constructors_enabled = (!std::is_same<std::decay_t<value_type>, std::decay_t<error_type>>::value || (std::is_void<value_type>::value && std::is_void<error_type>::value)) //
&& (!std::is_same<std::decay_t<value_type>, std::decay_t<exception_type>>::value || (std::is_void<value_type>::value && std::is_void<exception_type>::value)) //
&& (!std::is_same<std::decay_t<error_type>, std::decay_t<exception_type>>::value || (std::is_void<error_type>::value && std::is_void<exception_type>::value)) //
;
// Predicate for implicit constructors to be available at all
static constexpr bool implicit_constructors_enabled = constructors_enabled && base::implicit_constructors_enabled;
//! Predicate for the value converting constructor to be available.
template <class T>
static constexpr bool enable_value_converting_constructor = //
constructors_enabled //
&& !std::is_same<std::decay_t<T>, basic_outcome>::value // not my type
&& base::template enable_value_converting_constructor<T>;
//! Predicate for the error converting constructor to be available.
template <class T>
static constexpr bool enable_error_converting_constructor = //
constructors_enabled //
&& !std::is_same<std::decay_t<T>, basic_outcome>::value // not my type
&& base::template enable_error_converting_constructor<T>;
//! Predicate for the error condition converting constructor to be available.
template <class ErrorCondEnum>
static constexpr bool enable_error_condition_converting_constructor = //
constructors_enabled //
&& !std::is_same<std::decay_t<ErrorCondEnum>, basic_outcome>::value // not my type
&& base::template enable_error_condition_converting_constructor<ErrorCondEnum>;
// Predicate for the exception converting constructor to be available.
template <class T>
static constexpr bool enable_exception_converting_constructor = //
constructors_enabled //
&& !std::is_same<std::decay_t<T>, basic_outcome>::value // not my type
&& base::template enable_exception_converting_constructor<T>;
// Predicate for the error + exception converting constructor to be available.
template <class T, class U>
static constexpr bool enable_error_exception_converting_constructor = //
constructors_enabled //
&& !std::is_same<std::decay_t<T>, basic_outcome>::value // not my type
&& base::template enable_error_exception_converting_constructor<T, U>;
//! Predicate for the converting constructor from a compatible input to be available.
template <class T, class U, class V, class W>
static constexpr bool enable_compatible_conversion = //
constructors_enabled //
&& !std::is_same<basic_outcome<T, U, V, W>, basic_outcome>::value // not my type
&& base::template enable_compatible_conversion<T, U, V, W>;
//! Predicate for the inplace construction of value to be available.
template <class... Args>
static constexpr bool enable_inplace_value_constructor = //
constructors_enabled //
&& (std::is_void<value_type>::value //
|| std::is_constructible<value_type, Args...>::value);
//! Predicate for the inplace construction of error to be available.
template <class... Args>
static constexpr bool enable_inplace_error_constructor = //
constructors_enabled //
&& (std::is_void<error_type>::value //
|| std::is_constructible<error_type, Args...>::value);
//! Predicate for the inplace construction of exception to be available.
template <class... Args>
static constexpr bool enable_inplace_exception_constructor = //
constructors_enabled //
&& (std::is_void<exception_type>::value //
|| std::is_constructible<exception_type, Args...>::value);
// Predicate for the implicit converting inplace constructor to be available.
template <class... Args>
static constexpr bool enable_inplace_value_error_exception_constructor = //
constructors_enabled //
&&base::template enable_inplace_value_error_exception_constructor<Args...>;
template <class... Args> using choose_inplace_value_error_exception_constructor = typename base::template choose_inplace_value_error_exception_constructor<Args...>;
};
public:
//! Used to disable in place type construction when `value_type` is ambiguous with `error_type` or `exception_type`.
using value_type_if_enabled = std::conditional_t<std::is_same<value_type, error_type>::value || std::is_same<value_type, exception_type>::value, disable_in_place_value_type, value_type>;
//! Used to disable in place type construction when `error_type` is ambiguous with `value_type` or `exception_type`.
using error_type_if_enabled = std::conditional_t<std::is_same<error_type, value_type>::value || std::is_same<error_type, exception_type>::value, disable_in_place_error_type, error_type>;
//! Used to disable in place type construction when `exception_type` is ambiguous with `value_type` or `error_type`.
using exception_type_if_enabled = std::conditional_t<std::is_same<exception_type, value_type>::value || std::is_same<exception_type, error_type>::value, disable_in_place_exception_type, exception_type>;
protected:
detail::devoid<exception_type> _ptr;
public:
/// \output_section Disabling constructors
/*! Disabling constructor for when all constructors are disabled.
\tparam 2
\exclude
\requires Any one of `value_type`, `error_type` and `exception_type` to be the same type.
\effects Declares a catch-all constructor which is deleted to give a clear error message to the user
that identical `value_type`, `error_type` or `exception_type` is not supported, whilst also preserving compile-time introspection.
*/
OUTCOME_TEMPLATE(class Arg, class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED((!predicate::constructors_enabled && sizeof...(Args) >= 0)))
basic_outcome(Arg && /*unused*/, Args &&... /*unused*/) = delete; // NOLINT basic_outcome<> with any of the same type is NOT SUPPORTED, see docs!
/*! Disabling implicit constructor for when implicit constructors are disabled.
\tparam 1
\exclude
\requires Any one of `value_type`, `error_type` and `exception_type` to be ambiguous.
\effects Declares a value type constructor which is deleted to give a clear error message to the user
that `value_type` or `error_type` or `exception_type` are ambiguous, whilst also preserving compile-time introspection.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED((predicate::constructors_enabled && !predicate::implicit_constructors_enabled //
&& (detail::is_implicitly_constructible<value_type, T> || detail::is_implicitly_constructible<error_type, T> || detail::is_implicitly_constructible<exception_type, T>) )))
basic_outcome(T && /*unused*/, implicit_constructors_disabled_tag /*unused*/ = implicit_constructors_disabled_tag()) = delete; // NOLINT Implicit constructors disabled, use explicit in_place_type<T>, success() or failure(). see docs!
/// \output_section Converting constructors
/*! Converting constructor to a successful outcome.
\tparam 1
\exclude
\param 1
\exclude
\param t The value from which to initialise the `value_type`.
\effects Initialises the outcome with a `value_type`.
\requires Type T is implicitly constructible to `value_type`, is not implicitly constructible to `error_type`, is not implicitly constructible to `exception_type` and is not `outcome<R, S, P>` and not `in_place_type<>`.
\throws Any exception the construction of `value_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_value_converting_constructor<T>))
constexpr basic_outcome(T &&t, value_converting_constructor_tag /*unused*/ = value_converting_constructor_tag()) noexcept(std::is_nothrow_constructible<value_type, T>::value) // NOLINT
: base{in_place_type<typename base::_value_type>, static_cast<T &&>(t)},
_ptr()
{
using namespace hooks;
hook_outcome_construction(this, static_cast<T &&>(t));
}
/*! Converting constructor to an errored outcome.
\tparam 1
\exclude
\param 1
\exclude
\param t The value from which to initialise the `error_type`.
\effects Initialises the outcome with a `error_type`.
\requires Type T is implicitly constructible to `error_type`,
is not implicitly constructible to `value_type`, is not implicitly constructible to `exception_type`, and is not `outcome<R, S, P>` and not `in_place_type<>`.
\throws Any exception the construction of `error_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_error_converting_constructor<T>))
constexpr basic_outcome(T &&t, error_converting_constructor_tag /*unused*/ = error_converting_constructor_tag()) noexcept(std::is_nothrow_constructible<error_type, T>::value) // NOLINT
: base{in_place_type<typename base::_error_type>, static_cast<T &&>(t)},
_ptr()
{
using namespace hooks;
hook_outcome_construction(this, static_cast<T &&>(t));
}
/*! Special error condition converting constructor to an errored outcome.
\tparam 1
\exclude
\tparam 2
\exclude
\param 1
\exclude
\param t The error condition from which to initialise the `error_type`.
\effects Initialises the outcome with a `error_type` constructed via `make_error_code(t)`.
\requires `std::is_error_condition_enum<ErrorCondEnum>` must be true,
`ErrorCondEnum` is not implicitly constructible to `value_type`, `error_type` nor `exception_type`, and is not `outcome<R, S, P>` and not `in_place_type<>`;
Finally, the expression `error_type(make_error_code(ErrorCondEnum()))` must be valid.
\throws Any exception the construction of `error_type(make_error_code(t))` might throw.
*/
OUTCOME_TEMPLATE(class ErrorCondEnum)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(error_type(make_error_code(ErrorCondEnum()))), //
OUTCOME_TPRED(predicate::template enable_error_condition_converting_constructor<ErrorCondEnum>))
constexpr basic_outcome(ErrorCondEnum &&t, error_condition_converting_constructor_tag /*unused*/ = error_condition_converting_constructor_tag()) noexcept(noexcept(error_type(make_error_code(static_cast<ErrorCondEnum &&>(t))))) // NOLINT
: base{in_place_type<typename base::_error_type>, make_error_code(t)}
{
using namespace hooks;
hook_outcome_construction(this, static_cast<ErrorCondEnum &&>(t));
}
/*! Converting constructor to an excepted outcome.
\tparam 1
\exclude
\param 1
\exclude
\param t The value from which to initialise the `exception_type`.
\effects Initialises the outcome with a `exception_type`.
\requires Type T is implicitly constructible to `exception_type`,
is not implicitly constructible to `value_type`, is not implicitly constructible to `error_type`, and is not `outcome<R, S, P>` and not `in_place_type<>`.
\throws Any exception the construction of `exception_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_exception_converting_constructor<T>))
constexpr basic_outcome(T &&t, exception_converting_constructor_tag /*unused*/ = exception_converting_constructor_tag()) noexcept(std::is_nothrow_constructible<exception_type, T>::value) // NOLINT
: base(),
_ptr(static_cast<T &&>(t))
{
using namespace hooks;
this->_state._status |= detail::status_have_exception;
hook_outcome_construction(this, static_cast<T &&>(t));
}
/*! Converting constructor to an errored + excepted outcome.
\tparam 2
\exclude
\param 2
\exclude
\param a The value from which to initialise the `errot_type`.
\param b The value from which to initialise the `exception_type`.
\effects Initialises the outcome with `error_type` and `exception_type`.
\requires Type T is implicitly constructible to `error_type`, type U is implicitly constructible to `exception_type`,
neither is implicitly constructible to `value_type`, and is not `outcome<R, S, P>` and not `in_place_type<>`.
\throws Any exception the construction of `error_type(T)` or `exception_type(U)` might throw.
*/
OUTCOME_TEMPLATE(class T, class U)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_error_exception_converting_constructor<T, U>))
constexpr basic_outcome(T &&a, U &&b, error_exception_converting_constructor_tag /*unused*/ = error_exception_converting_constructor_tag()) noexcept(std::is_nothrow_constructible<error_type, T>::value &&std::is_nothrow_constructible<exception_type, U>::value) // NOLINT
: base{in_place_type<typename base::_error_type>, static_cast<T &&>(a)},
_ptr(static_cast<U &&>(b))
{
using namespace hooks;
this->_state._status |= detail::status_have_exception;
hook_outcome_construction(this, static_cast<T &&>(a), static_cast<U &&>(b));
}
/*! Explicit converting constructor from a compatible `ValueOrError` type.
\tparam 1
\exclude
\tparam 2
\exclude
\tparam 3
\exclude
\param 1
\exclude
\param o The input for which a `convert::value_or_error<outcome, std::decay_t<T>>{}(std::forward<T>(o))` is available.
\effects Initialises the outcome with the contents of the compatible input.
\requires That `convert::value_or_error<outcome, std::decay_t<T>>{}(std::forward<T>(o))` be available. The
default implementation will consume `T`'s matching the `ValueOrError` concept type.
`ValueOrError` concept matches any type with a `value_type`,
an `error_type`, a `.value()`, an `.error()` and a `.has_value()`.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(convert::value_or_error<basic_outcome, std::decay_t<T>>::enable_result_inputs || !is_basic_result_v<T>), //
OUTCOME_TPRED(convert::value_or_error<basic_outcome, std::decay_t<T>>::enable_outcome_inputs || !is_basic_outcome_v<T>), //
OUTCOME_TEXPR(convert::value_or_error<basic_outcome, std::decay_t<T>>{}(std::declval<T>())))
constexpr explicit basic_outcome(T &&o, explicit_valueorerror_converting_constructor_tag /*unused*/ = explicit_valueorerror_converting_constructor_tag()) // NOLINT
: basic_outcome{convert::value_or_error<basic_outcome, std::decay_t<T>>{}(static_cast<T &&>(o))}
{
}
/*! Explicit converting copy constructor from a compatible outcome type.
\tparam 4
\exclude
\param o The compatible outcome.
\effects Initialises the outcome with a copy of the compatible outcome.
\requires Both outcome's `value_type`, `error_type`, and `exception_type` need to be constructible, or the source `void`.
\throws Any exception the construction of `value_type(T)`, `error_type(U)` or `exception_type(V)` might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V, class W)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_compatible_conversion<T, U, V, W>))
constexpr explicit basic_outcome(const basic_outcome<T, U, V, W> &o) noexcept(std::is_nothrow_constructible<value_type, T>::value &&std::is_nothrow_constructible<error_type, U>::value &&std::is_nothrow_constructible<exception_type, V>::value)
: base{typename base::compatible_conversion_tag(), o}
, _ptr(o._ptr)
{
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Explicit converting move constructor from a compatible outcome type.
\tparam 4
\exclude
\param o The compatible outcome.
\effects Initialises the outcome with a move of the compatible outcome.
\requires Both outcome's `value_type`, `error_type`, and `exception_type` need to be constructible, or the source `void`.
\throws Any exception the construction of `value_type(T)`, `error_type(U)` or `exception_type(V)` might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V, class W)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_compatible_conversion<T, U, V, W>))
constexpr explicit basic_outcome(basic_outcome<T, U, V, W> &&o) noexcept(std::is_nothrow_constructible<value_type, T>::value &&std::is_nothrow_constructible<error_type, U>::value &&std::is_nothrow_constructible<exception_type, V>::value)
: base{typename base::compatible_conversion_tag(), static_cast<basic_outcome<T, U, V, W> &&>(o)}
, _ptr(static_cast<typename basic_outcome<T, U, V, W>::exception_type &&>(o._ptr))
{
using namespace hooks;
hook_outcome_move_construction(this, static_cast<basic_outcome<T, U, V, W> &&>(o));
}
/*! Explicit converting copy constructor from a compatible result type.
\tparam 3
\exclude
\param o The compatible result.
\effects Initialises the outcome with a copy of the compatible result.
\requires Both outcome's `value_type` and `error_type` need to be constructible, or the source `void`.
\throws Any exception the construction of `value_type(T)`, `error_type(U)` or `exception_type()` might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V)
OUTCOME_TREQUIRES(OUTCOME_TPRED(detail::result_predicates<value_type, error_type>::template enable_compatible_conversion<T, U, V>))
constexpr explicit basic_outcome(const basic_result<T, U, V> &o) noexcept(std::is_nothrow_constructible<value_type, T>::value &&std::is_nothrow_constructible<error_type, U>::value &&std::is_nothrow_constructible<exception_type>::value)
: base{typename base::compatible_conversion_tag(), o}
, _ptr()
{
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Explicit converting move constructor from a compatible result type.
\tparam 3
\exclude
\param o The compatible result.
\effects Initialises the outcome with a move of the compatible result.
\requires Both outcome's `value_type` and `error_type` need to be constructible, or the source `void`.
\throws Any exception the construction of `value_type(T)`, `error_type(U)` or `exception_type()` might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V)
OUTCOME_TREQUIRES(OUTCOME_TPRED(detail::result_predicates<value_type, error_type>::template enable_compatible_conversion<T, U, V>))
constexpr explicit basic_outcome(basic_result<T, U, V> &&o) noexcept(std::is_nothrow_constructible<value_type, T>::value &&std::is_nothrow_constructible<error_type, U>::value &&std::is_nothrow_constructible<exception_type>::value)
: base{typename base::compatible_conversion_tag(), static_cast<basic_result<T, U, V> &&>(o)}
, _ptr()
{
using namespace hooks;
hook_outcome_move_construction(this, static_cast<basic_result<T, U, V> &&>(o));
}
/// \output_section In place constructors
/*! Inplace constructor to a successful value.
\tparam 1
\exclude
\param _ Tag type to indicate we are doing in place construction of `value_type`.
\param args Arguments with which to in place construct.
\effects Initialises the outcome with a `value_type`.
\requires `value_type` is void or `Args...` are constructible to `value_type`.
\throws Any exception the construction of `value_type(Args...)` might throw.
*/
OUTCOME_TEMPLATE(class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_value_constructor<Args...>))
constexpr explicit basic_outcome(in_place_type_t<value_type_if_enabled> _, Args &&... args) noexcept(std::is_nothrow_constructible<value_type, Args...>::value)
: base{_, static_cast<Args &&>(args)...}
, _ptr()
{
using namespace hooks;
hook_outcome_in_place_construction(this, in_place_type<value_type>, static_cast<Args &&>(args)...);
}
/*! Inplace constructor to a successful value.
\tparam 2
\exclude
\param _ Tag type to indicate we are doing in place construction of `value_type`.
\param il An initializer list with which to in place construct.
\param args Arguments with which to in place construct.
\effects Initialises the outcome with a `value_type`.
\requires The initializer list + `Args...` are constructible to `value_type`.
\throws Any exception the construction of `value_type(il, Args...)` might throw.
*/
OUTCOME_TEMPLATE(class U, class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_value_constructor<std::initializer_list<U>, Args...>))
constexpr explicit basic_outcome(in_place_type_t<value_type_if_enabled> _, std::initializer_list<U> il, Args &&... args) noexcept(std::is_nothrow_constructible<value_type, std::initializer_list<U>, Args...>::value)
: base{_, il, static_cast<Args &&>(args)...}
, _ptr()
{
using namespace hooks;
hook_outcome_in_place_construction(this, in_place_type<value_type>, il, static_cast<Args &&>(args)...);
}
/*! Inplace constructor to an unsuccessful error.
\tparam 1
\exclude
\param _ Tag type to indicate we are doing in place construction of `error_type`.
\param args Arguments with which to in place construct.
\effects Initialises the outcome with a `error_type`.
\requires `error_type` is void or `Args...` are constructible to `error_type`.
\throws Any exception the construction of `error_type(Args...)` might throw.
*/
OUTCOME_TEMPLATE(class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_error_constructor<Args...>))
constexpr explicit basic_outcome(in_place_type_t<error_type_if_enabled> _, Args &&... args) noexcept(std::is_nothrow_constructible<error_type, Args...>::value)
: base{_, static_cast<Args &&>(args)...}
, _ptr()
{
using namespace hooks;
hook_outcome_in_place_construction(this, in_place_type<error_type>, static_cast<Args &&>(args)...);
}
/*! Inplace constructor to an unsuccessful error.
\tparam 2
\exclude
\param _ Tag type to indicate we are doing in place construction of `error_type`.
\param il An initializer list with which to in place construct.
\param args Arguments with which to in place construct.
\effects Initialises the outcome with a `error_type`.
\requires The initializer list + `Args...` are constructible to `error_type`.
\throws Any exception the construction of `error_type(il, Args...)` might throw.
*/
OUTCOME_TEMPLATE(class U, class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_error_constructor<std::initializer_list<U>, Args...>))
constexpr explicit basic_outcome(in_place_type_t<error_type_if_enabled> _, std::initializer_list<U> il, Args &&... args) noexcept(std::is_nothrow_constructible<error_type, std::initializer_list<U>, Args...>::value)
: base{_, il, static_cast<Args &&>(args)...}
, _ptr()
{
using namespace hooks;
hook_outcome_in_place_construction(this, in_place_type<error_type>, il, static_cast<Args &&>(args)...);
}
/*! Inplace constructor to an unsuccessful exception.
\tparam 1
\exclude
\param _ Tag type to indicate we are doing in place construction of `exception_type`.
\param args Arguments with which to in place construct.
\effects Initialises the outcome with an `exception_type`.
\requires `exception_type` is void or `Args...` are constructible to `exception_type`.
\throws Any exception the construction of `exception_type(Args...)` might throw.
*/
OUTCOME_TEMPLATE(class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_exception_constructor<Args...>))
constexpr explicit basic_outcome(in_place_type_t<exception_type_if_enabled> /*unused*/, Args &&... args) noexcept(std::is_nothrow_constructible<exception_type, Args...>::value)
: base()
, _ptr(static_cast<Args &&>(args)...)
{
using namespace hooks;
this->_state._status |= detail::status_have_exception;
hook_outcome_in_place_construction(this, in_place_type<exception_type>, static_cast<Args &&>(args)...);
}
/*! Inplace constructor to an unsuccessful exception.
\tparam 2
\exclude
\param _ Tag type to indicate we are doing in place construction of `exception_type`.
\param il An initializer list with which to in place construct.
\param args Arguments with which to in place construct.
\effects Initialises the outcome with an `exception_type`.
\requires The initializer list + `Args...` are constructible to `exception_type`.
\throws Any exception the construction of `exception_type(il, Args...)` might throw.
*/
OUTCOME_TEMPLATE(class U, class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_exception_constructor<std::initializer_list<U>, Args...>))
constexpr explicit basic_outcome(in_place_type_t<exception_type_if_enabled> /*unused*/, std::initializer_list<U> il, Args &&... args) noexcept(std::is_nothrow_constructible<exception_type, std::initializer_list<U>, Args...>::value)
: base()
, _ptr(il, static_cast<Args &&>(args)...)
{
using namespace hooks;
this->_state._status |= detail::status_have_exception;
hook_outcome_in_place_construction(this, in_place_type<exception_type>, il, static_cast<Args &&>(args)...);
}
/*! Implicit inplace constructor to successful value, or unsuccessful error, or unsuccessful exception.
\tparam 3
\exclude
\param args Arguments with which to in place construct.
\effects Calls the appropriate `in_place_type_t<...>` constructor depending on constructibility of args.
\requires That the args can construct exactly one of `value_type` or `error_type` or `exception_type`.
\throws Any exception the `in_place_type_t<...>` constructor might throw.
*/
OUTCOME_TEMPLATE(class A1, class A2, class... Args)
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_value_error_exception_constructor<A1, A2, Args...>))
constexpr basic_outcome(A1 &&a1, A2 &&a2, Args &&... args) noexcept(noexcept(typename predicate::template choose_inplace_value_error_exception_constructor<A1, A2, Args...>(std::declval<A1>(), std::declval<A2>(), std::declval<Args>()...)))
: basic_outcome(in_place_type<typename predicate::template choose_inplace_value_error_exception_constructor<A1, A2, Args...>>, static_cast<A1 &&>(a1), static_cast<A2 &&>(a2), static_cast<Args &&>(args)...)
{
}
/// \output_section Tagged constructors
/*! Implicit tagged constructor of a successful outcome.
\param o The compatible success type sugar.
\effects Initialises the outcome with a default constructed success type.
\requires `value_type` to be default constructible, or `void`.
\throws Any exception the construction of `value_type()` might throw.
*/
constexpr basic_outcome(const success_type<void> &o) noexcept(std::is_nothrow_default_constructible<value_type>::value) // NOLINT
: base{in_place_type<typename base::_value_type>}
{
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a successful outcome.
\tparam 1
\exclude
\param o The compatible success type sugar.
\effects Initialises the outcome with a copy of the value in the type sugar.
\requires Both outcome and success' `value_type` need to be constructible. The source cannot be `void`.
\throws Any exception the construction of `value_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<T>::value && predicate::template enable_compatible_conversion<T, void, void, void>))
constexpr basic_outcome(const success_type<T> &o) noexcept(std::is_nothrow_constructible<value_type, T>::value) // NOLINT
: base{in_place_type<typename base::_value_type>, detail::extract_value_from_success<value_type>(o)}
{
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a successful outcome.
\tparam 1
\exclude
\param o The compatible success type sugar.
\effects Initialises the outcome with a move of the value in the type sugar.
\requires Both outcome and success' `value_type` need to be constructible. The source cannot be `void`.
\throws Any exception the construction of `value_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<T>::value && predicate::template enable_compatible_conversion<T, void, void, void>))
constexpr basic_outcome(success_type<T> &&o) noexcept(std::is_nothrow_constructible<value_type, T>::value) // NOLINT
: base{in_place_type<typename base::_value_type>, detail::extract_value_from_success<value_type>(static_cast<success_type<T> &&>(o))}
{
using namespace hooks;
hook_outcome_move_construction(this, static_cast<success_type<T> &&>(o));
}
/*! Implicit tagged constructor of a failure outcome.
\tparam 1
\exclude
\param o The compatible failure type sugar.
\effects Initialises the outcome with a copy of the error in the type sugar.
\requires Outcome's `error_type` needs to be constructible from failure's `error_type`.
\throws Any exception the construction of `error_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<T>::value && predicate::template enable_compatible_conversion<void, T, void, void>))
constexpr basic_outcome(const failure_type<T> &o, error_failure_tag /*unused*/ = error_failure_tag()) noexcept(std::is_nothrow_constructible<error_type, T>::value) // NOLINT
: base{in_place_type<typename base::_error_type>, detail::extract_error_from_failure<error_type>(o)},
_ptr()
{
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a failure outcome.
\tparam 1
\exclude
\param o The compatible failure type sugar.
\effects Initialises the outcome with a copy of the exception in the type sugar.
\requires Outcome's `exception_type` needs to be constructible from failure's `error_type`.
\throws Any exception the construction of `exception_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<T>::value && predicate::template enable_compatible_conversion<void, void, T, void>))
constexpr basic_outcome(const failure_type<T> &o, exception_failure_tag /*unused*/ = exception_failure_tag()) noexcept(std::is_nothrow_constructible<exception_type, T>::value) // NOLINT
: base(),
_ptr(detail::extract_exception_from_failure<exception_type>(o))
{
this->_state._status |= detail::status_have_exception;
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a failure outcome.
\tparam 2
\exclude
\param o The compatible failure type sugar.
\effects Initialises the outcome with a copy of the error and exception in the type sugar.
\requires Both outcome and failure's `error_type` and `exception_type` need to be constructible, or the source can be `void`.
\throws Any exception the construction of `error_type(T)` and `exception_type(U)` might throw.
*/
OUTCOME_TEMPLATE(class T, class U)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<U>::value && predicate::template enable_compatible_conversion<void, T, U, void>))
constexpr basic_outcome(const failure_type<T, U> &o) noexcept(std::is_nothrow_constructible<error_type, T>::value &&std::is_nothrow_constructible<exception_type, U>::value) // NOLINT
: base{in_place_type<typename base::_error_type>, detail::extract_error_from_failure<error_type>(o)},
_ptr(detail::extract_exception_from_failure<exception_type>(o))
{
if(!o.has_error())
{
this->_state._status &= ~detail::status_have_error;
}
if(o.has_exception())
{
this->_state._status |= detail::status_have_exception;
}
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a failure outcome.
\tparam 1
\exclude
\param o The compatible failure type sugar.
\effects Initialises the outcome with a move of the error in the type sugar.
\requires Outcome's `error_type` needs to be constructible from failure's `error_type`.
\throws Any exception the construction of `error_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<T>::value && predicate::template enable_compatible_conversion<void, T, void, void>))
constexpr basic_outcome(failure_type<T> &&o, error_failure_tag /*unused*/ = error_failure_tag()) noexcept(std::is_nothrow_constructible<error_type, T>::value) // NOLINT
: base{in_place_type<typename base::_error_type>, detail::extract_error_from_failure<error_type>(static_cast<failure_type<T> &&>(o))},
_ptr()
{
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a failure outcome.
\tparam 1
\exclude
\param o The compatible failure type sugar.
\effects Initialises the outcome with a move of the exception in the type sugar.
\requires Outcome's `exception_type` needs to be constructible from failure's `error_type`.
\throws Any exception the construction of `exception_type(T)` might throw.
*/
OUTCOME_TEMPLATE(class T)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<T>::value && predicate::template enable_compatible_conversion<void, void, T, void>))
constexpr basic_outcome(failure_type<T> &&o, exception_failure_tag /*unused*/ = exception_failure_tag()) noexcept(std::is_nothrow_constructible<exception_type, T>::value) // NOLINT
: base(),
_ptr(detail::extract_exception_from_failure<exception_type>(static_cast<failure_type<T> &&>(o)))
{
this->_state._status |= detail::status_have_exception;
using namespace hooks;
hook_outcome_copy_construction(this, o);
}
/*! Implicit tagged constructor of a failure outcome.
\tparam 2
\exclude
\param o The compatible failure type sugar.
\effects Initialises the outcome with a move of the error and exception in the type sugar.
\requires Both outcome and failure's `error_type` and `exception_type` need to be constructible, or the source can be `void`.
\throws Any exception the construction of `error_type(T)` and `exception_type(U)` might throw.
*/
OUTCOME_TEMPLATE(class T, class U)
OUTCOME_TREQUIRES(OUTCOME_TPRED(!std::is_void<U>::value && predicate::template enable_compatible_conversion<void, T, U, void>))
constexpr basic_outcome(failure_type<T, U> &&o) noexcept(std::is_nothrow_constructible<error_type, T>::value &&std::is_nothrow_constructible<exception_type, U>::value) // NOLINT
: base{in_place_type<typename base::_error_type>, detail::extract_error_from_failure<error_type>(static_cast<failure_type<T, U> &&>(o))},
_ptr(detail::extract_exception_from_failure<exception_type>(static_cast<failure_type<T, U> &&>(o)))
{
if(!o.has_error())
{
this->_state._status &= ~detail::status_have_error;
}
if(o.has_exception())
{
this->_state._status |= detail::status_have_exception;
}
using namespace hooks;
hook_outcome_move_construction(this, static_cast<failure_type<T, U> &&>(o));
}
/// \output_section Comparison operators
using base::operator==;
using base::operator!=;
/*! True if equal to the other outcome.
\param o The other outcome to compare to.
\requires That both `value_type`'s have an `operator==` available;
that both `error_type`'s have an `operator==` available;
that both `exception_type`'s have an `operator==` available.
\effects Calls the `operator==` operation on any common stored state.
Otherwise returns false. Ignores spare storage.
\throws Any exception the individual `operator==` operations might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V, class W)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(std::declval<detail::devoid<value_type>>() == std::declval<detail::devoid<T>>()), //
OUTCOME_TEXPR(std::declval<detail::devoid<error_type>>() == std::declval<detail::devoid<U>>()), //
OUTCOME_TEXPR(std::declval<detail::devoid<exception_type>>() == std::declval<detail::devoid<V>>()))
constexpr bool operator==(const basic_outcome<T, U, V, W> &o) const noexcept( //
noexcept(std::declval<detail::devoid<value_type>>() == std::declval<detail::devoid<T>>()) //
&& noexcept(std::declval<detail::devoid<error_type>>() == std::declval<detail::devoid<U>>()) //
&& noexcept(std::declval<detail::devoid<exception_type>>() == std::declval<detail::devoid<V>>()))
{
if((this->_state._status & detail::status_have_value) != 0 && (o._state._status & detail::status_have_value) != 0)
{
return this->_state._value == o._state._value; // NOLINT
}
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0 //
&& (this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_error == o._error && this->_ptr == o._ptr;
}
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0)
{
return this->_error == o._error;
}
if((this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_ptr == o._ptr;
}
return false;
}
/*! True if equal to the failure type sugar.
\param o The failure type sugar to compare to.
\requires That both `error_type`'s have an `operator==` available;
that both `exception_type`'s have an `operator==` available.
\effects Calls the `operator==` operation on any common stored state.
Otherwise returns false. Ignores spare storage.
\throws Any exception the individual `operator==` operations might throw.
*/
OUTCOME_TEMPLATE(class T, class U)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(std::declval<error_type>() == std::declval<T>()), //
OUTCOME_TEXPR(std::declval<exception_type>() == std::declval<U>()))
constexpr bool operator==(const failure_type<T, U> &o) const noexcept( //
noexcept(std::declval<error_type>() == std::declval<T>()) && noexcept(std::declval<exception_type>() == std::declval<U>()))
{
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0 //
&& (this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_error == o.error() && this->_ptr == o.exception();
}
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0)
{
return this->_error == o.error();
}
if((this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_ptr == o.exception();
}
return false;
}
/*! True if not equal to the other outcome.
\param o The other outcome to compare to.
\requires That both `value_type`'s have an `operator!=` available;
that both `error_type`'s have an `operator!=` available;
that both `exception_type`'s have an `operator!=` available.
\effects Calls the `operator!=` operation on any common stored state.
Otherwise returns true. Ignores spare storage.
\throws Any exception the individual `operator!=` operations might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V, class W)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(std::declval<detail::devoid<value_type>>() != std::declval<detail::devoid<T>>()), //
OUTCOME_TEXPR(std::declval<detail::devoid<error_type>>() != std::declval<detail::devoid<U>>()), //
OUTCOME_TEXPR(std::declval<detail::devoid<exception_type>>() != std::declval<detail::devoid<V>>()))
constexpr bool operator!=(const basic_outcome<T, U, V, W> &o) const noexcept( //
noexcept(std::declval<detail::devoid<value_type>>() != std::declval<detail::devoid<T>>()) //
&& noexcept(std::declval<detail::devoid<error_type>>() != std::declval<detail::devoid<U>>()) //
&& noexcept(std::declval<detail::devoid<exception_type>>() != std::declval<detail::devoid<V>>()))
{
if((this->_state._status & detail::status_have_value) != 0 && (o._state._status & detail::status_have_value) != 0)
{
return this->_state._value != o._state._value; // NOLINT
}
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0 //
&& (this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_error != o._error || this->_ptr != o._ptr;
}
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0)
{
return this->_error != o._error;
}
if((this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_ptr != o._ptr;
}
return true;
}
/*! True if not equal to the failure type sugar.
\param o The failure type sugar to compare to.
\requires That both `error_type`'s have an `operator!=` available;
that both `exception_type`'s have an `operator!=` available.
\effects Calls the `operator!=` operation on any common stored state.
Otherwise returns true. Ignores spare storage.
\throws Any exception the individual `operator!=` operations might throw.
*/
OUTCOME_TEMPLATE(class T, class U)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(std::declval<error_type>() != std::declval<T>()), //
OUTCOME_TEXPR(std::declval<exception_type>() != std::declval<U>()))
constexpr bool operator!=(const failure_type<T, U> &o) const noexcept( //
noexcept(std::declval<error_type>() == std::declval<T>()) && noexcept(std::declval<exception_type>() == std::declval<U>()))
{
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0 //
&& (this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_error != o.error() || this->_ptr != o.exception();
}
if((this->_state._status & detail::status_have_error) != 0 && (o._state._status & detail::status_have_error) != 0)
{
return this->_error != o.error();
}
if((this->_state._status & detail::status_have_exception) != 0 && (o._state._status & detail::status_have_exception) != 0)
{
return this->_ptr != o.exception();
}
return true;
}
/// \output_section Swap
/*! Swaps this result with another result
\effects Any `R` and/or `S` is swapped along with the metadata tracking them.
\throws If the swap of value or error or exception can throw, the throwing swap is done first.
If more than one of those can throw, the object is left in an indeterminate state should a throw occur.
*/
void swap(basic_outcome &o) noexcept(detail::is_nothrow_swappable<value_type>::value &&std::is_nothrow_move_constructible<value_type>::value //
&&detail::is_nothrow_swappable<error_type>::value &&std::is_nothrow_move_constructible<error_type>::value //
&&detail::is_nothrow_swappable<exception_type>::value &&std::is_nothrow_move_constructible<exception_type>::value)
{
using std::swap;
constexpr bool value_throws = !noexcept(this->_state.swap(o._state));
constexpr bool error_throws = !noexcept(swap(this->_ptr, o._ptr));
constexpr bool exception_throws = !noexcept(swap(this->_ptr, o._ptr));
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
#endif
// Do throwing swap first
if(value_throws && !error_throws && !exception_throws)
{
this->_state.swap(o._state);
swap(this->_error, o._error);
swap(this->_ptr, o._ptr);
}
else if(!value_throws && !error_throws && exception_throws)
{
swap(this->_ptr, o._ptr);
this->_state.swap(o._state);
swap(this->_error, o._error);
}
else if(!value_throws && error_throws && !exception_throws)
{
swap(this->_error, o._error);
this->_state.swap(o._state);
swap(this->_ptr, o._ptr);
}
else
{
this->_state.swap(o._state);
swap(this->_error, o._error);
swap(this->_ptr, o._ptr);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
/// \output_section Converters
/*! Returns this outcome as a `failure_type` with any errored and/or excepted state copied.
\requires This outcome to have a failed state, else whatever `assume_error()` would do.
*/
failure_type<error_type, exception_type> as_failure() const &
{
if(this->has_error() && this->has_exception())
{
return failure_type<error_type, exception_type>(this->assume_error(), this->assume_exception());
}
if(this->has_exception())
{
return failure_type<error_type, exception_type>(in_place_type<exception_type>, this->assume_exception());
}
return failure_type<error_type, exception_type>(in_place_type<error_type>, this->assume_error());
}
/*! Returns this outcome as a `failure_type` with any errored and/or excepted state moved.
\requires This outcome to have a failed state, else whatever `assume_error()` would do.
*/
failure_type<error_type, exception_type> as_failure() &&
{
if(this->has_error() && this->has_exception())
{
return failure_type<error_type, exception_type>(static_cast<S &&>(this->assume_error()), static_cast<P &&>(this->assume_exception()));
}
if(this->has_exception())
{
return failure_type<error_type, exception_type>(in_place_type<exception_type>, static_cast<P &&>(this->assume_exception()));
}
return failure_type<error_type, exception_type>(in_place_type<error_type>, static_cast<S &&>(this->assume_error()));
}
};
/*! True if the result is equal to the outcome
\tparam 7
\exclude
\param a The result to compare.
\param b The outcome to compare.
\remarks Implemented as `b == a`.
\requires That the expression `b == a` is a valid expression.
\throws Any exception that `b == a` might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V, //
class R, class S, class P, class N)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(std::declval<basic_outcome<R, S, P, N>>() == std::declval<basic_result<T, U, V>>()))
constexpr inline bool operator==(const basic_result<T, U, V> &a, const basic_outcome<R, S, P, N> &b) noexcept( //
noexcept(std::declval<basic_outcome<R, S, P, N>>() == std::declval<basic_result<T, U, V>>()))
{
return b == a;
}
/*! True if the result is not equal to the outcome
\tparam 7
\exclude
\param a The result to compare.
\param b The outcome to compare.
\remarks Implemented as `b != a`.
\requires That the expression `b != a` is a valid expression.
\throws Any exception that `b != a` might throw.
*/
OUTCOME_TEMPLATE(class T, class U, class V, //
class R, class S, class P, class N)
OUTCOME_TREQUIRES(OUTCOME_TEXPR(std::declval<basic_outcome<R, S, P, N>>() != std::declval<basic_result<T, U, V>>()))
constexpr inline bool operator!=(const basic_result<T, U, V> &a, const basic_outcome<R, S, P, N> &b) noexcept( //
noexcept(std::declval<basic_outcome<R, S, P, N>>() != std::declval<basic_result<T, U, V>>()))
{
return b != a;
}
/*! Specialise swap for outcome.
\effects Calls `a.swap(b)`.
*/
template <class R, class S, class P, class N> inline void swap(basic_outcome<R, S, P, N> &a, basic_outcome<R, S, P, N> &b) noexcept(noexcept(a.swap(b)))
{
a.swap(b);
}
namespace hooks
{
/*! Used to set/override an exception during a construction hook implementation.
\param o The outcome you wish to change.
\param v Exception to be set.
\effects Sets the exception of the outcome to the given value.
*/
template <class R, class S, class P, class NoValuePolicy, class U> constexpr inline void override_outcome_exception(basic_outcome<R, S, P, NoValuePolicy> *o, U &&v) noexcept
{
o->_ptr = static_cast<U &&>(v); // NOLINT
o->_state._status |= detail::status_have_exception;
}
} // namespace hooks
OUTCOME_V2_NAMESPACE_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#include "detail/basic_outcome_exception_observers_impl.hpp"
#if !defined(NDEBUG)
OUTCOME_V2_NAMESPACE_BEGIN
// Check is trivial in all ways except default constructibility and standard layout
// static_assert(std::is_trivial<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivial!");
// static_assert(std::is_trivially_default_constructible<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially default constructible!");
static_assert(std::is_trivially_copyable<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially copyable!");
static_assert(std::is_trivially_assignable<basic_outcome<int, long, double, policy::all_narrow>, basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially assignable!");
static_assert(std::is_trivially_destructible<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially destructible!");
static_assert(std::is_trivially_copy_constructible<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially copy constructible!");
static_assert(std::is_trivially_move_constructible<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially move constructible!");
static_assert(std::is_trivially_copy_assignable<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially copy assignable!");
static_assert(std::is_trivially_move_assignable<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not trivially move assignable!");
// Can't be standard layout as non-static member data is defined in more than one inherited class
// static_assert(std::is_standard_layout<basic_outcome<int, long, double, policy::all_narrow>>::value, "outcome<int> is not a standard layout type!");
OUTCOME_V2_NAMESPACE_END
#endif
#endif
| 55.339853
| 272
| 0.694957
|
libbboze
|
1231177b23f567306fb5a337b5bbcb0bb24c19c9
| 367
|
cpp
|
C++
|
LeetCode/cpp/557.cpp
|
ZintrulCre/LeetCode_Archiver
|
de23e16ead29336b5ee7aa1898a392a5d6463d27
|
[
"MIT"
] | 279
|
2019-02-19T16:00:32.000Z
|
2022-03-23T12:16:30.000Z
|
LeetCode/cpp/557.cpp
|
ZintrulCre/LeetCode_Archiver
|
de23e16ead29336b5ee7aa1898a392a5d6463d27
|
[
"MIT"
] | 2
|
2019-03-31T08:03:06.000Z
|
2021-03-07T04:54:32.000Z
|
LeetCode/cpp/557.cpp
|
ZintrulCre/LeetCode_Crawler
|
de23e16ead29336b5ee7aa1898a392a5d6463d27
|
[
"MIT"
] | 12
|
2019-01-29T11:45:32.000Z
|
2019-02-04T16:31:46.000Z
|
class Solution {
public:
string reverseWords(string s) {
int n = s.size();
for (int i = 0; i < n; ++i) {
int j = i + 1;;
while (j < n && s[j] != ' ')
++j;
for (int k = i; k < (j + i) / 2; ++k)
swap(s[k], s[j + i - k - 1]);
i = j;
}
return s;
}
};
| 22.9375
| 49
| 0.307902
|
ZintrulCre
|
1233a9e44ecaaaefc354f105142d9f9c1080bb58
| 801
|
cpp
|
C++
|
Sid's Levels/Level - 2/Arrays/Merge2SortedVariation.cpp
|
Tiger-Team-01/DSA-A-Z-Practice
|
e08284ffdb1409c08158dd4e90dc75dc3a3c5b18
|
[
"MIT"
] | 14
|
2021-08-22T18:21:14.000Z
|
2022-03-08T12:04:23.000Z
|
Sid's Levels/Level - 2/Arrays/Merge2SortedVariation.cpp
|
Tiger-Team-01/DSA-A-Z-Practice
|
e08284ffdb1409c08158dd4e90dc75dc3a3c5b18
|
[
"MIT"
] | 1
|
2021-10-17T18:47:17.000Z
|
2021-10-17T18:47:17.000Z
|
Sid's Levels/Level - 2/Arrays/Merge2SortedVariation.cpp
|
Tiger-Team-01/DSA-A-Z-Practice
|
e08284ffdb1409c08158dd4e90dc75dc3a3c5b18
|
[
"MIT"
] | 5
|
2021-09-01T08:21:12.000Z
|
2022-03-09T12:13:39.000Z
|
class Solution {
public:
//OM GAN GANAPATHAYE NAMO NAMAH
//JAI SHRI RAM
//JAI BAJRANGBALI
//AMME NARAYANA, DEVI NARAYANA, LAKSHMI NARAYANA, BHADRE NARAYANA
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int gap = m + n;
int i, j, k;
i = m - 1;
j = n - 1;
k = m + n - 1;
while(i >= 0 && j >= 0)
{
if(nums1[i] > nums2[j])
{
nums1[k] = nums1[i];
k--;
i--;
}
else
{
nums1[k] = nums2[j];
k--;
j--;
}
}
while(j >= 0)
{
nums1[k] = nums2[j];
k--;
j--;
}
}
};
| 21.648649
| 70
| 0.332085
|
Tiger-Team-01
|
1234129e0f5f1094c19bf49f1e3700bae91fe5ed
| 243,150
|
hpp
|
C++
|
include/metaf.hpp
|
nnaumenko/metaf
|
9e7882649f1eb6bec9a031f30749e0843f3e424d
|
[
"MIT"
] | 10
|
2019-10-03T23:18:35.000Z
|
2021-11-05T13:54:58.000Z
|
include/metaf.hpp
|
sthagen/metaf
|
9e7882649f1eb6bec9a031f30749e0843f3e424d
|
[
"MIT"
] | 3
|
2019-10-03T23:24:11.000Z
|
2020-02-17T23:44:52.000Z
|
include/metaf.hpp
|
sthagen/metaf
|
9e7882649f1eb6bec9a031f30749e0843f3e424d
|
[
"MIT"
] | 6
|
2019-07-16T03:54:25.000Z
|
2021-03-13T15:30:47.000Z
|
/*
* Copyright (C) 2018-2020 Nick Naumenko (https://gitlab.com/nnaumenko)
* All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef METAF_HPP
#define METAF_HPP
#if defined(__clang__)
// No issues with clang
// But clang defines both __clang__ and __GNUC__
#elif defined(__GNUC__)
// GCC gives false positives in GroupParser::parse
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
// GCC gives numerous false positives in switch/return methods
#pragma GCC diagnostic ignored "-Wreturn-type"
// GCC gives false positives in Distance
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#include <string>
#include <vector>
#include <variant>
#include <optional>
#include <regex>
#include <cmath>
namespace metaf {
// Metaf library version
struct Version {
inline static const int major = 5;
inline static const int minor = 7;
inline static const int patch = 1;
inline static const char tag [] = "";
};
class KeywordGroup;
class LocationGroup;
class ReportTimeGroup;
class TrendGroup;
class WindGroup;
class VisibilityGroup;
class CloudGroup;
class WeatherGroup;
class TemperatureGroup;
class PressureGroup;
class RunwayStateGroup;
class SeaSurfaceGroup;
class MinMaxTemperatureGroup;
class PrecipitationGroup;
class LayerForecastGroup;
class PressureTendencyGroup;
class CloudTypesGroup;
class LowMidHighCloudGroup;
class LightningGroup;
class VicinityGroup;
class MiscGroup;
class UnknownGroup;
using Group = std::variant<
KeywordGroup,
LocationGroup,
ReportTimeGroup,
TrendGroup,
WindGroup,
VisibilityGroup,
CloudGroup,
WeatherGroup,
TemperatureGroup,
PressureGroup,
RunwayStateGroup,
SeaSurfaceGroup,
MinMaxTemperatureGroup,
PrecipitationGroup,
LayerForecastGroup,
PressureTendencyGroup,
CloudTypesGroup,
LowMidHighCloudGroup,
LightningGroup,
VicinityGroup,
MiscGroup,
UnknownGroup
>;
///////////////////////////////////////////////////////////////////////////
class Runway {
public:
enum class Designator {
NONE,
LEFT,
CENTER,
RIGHT,
};
unsigned int number() const { return rNumber; }
Designator designator() const { return rDesignator; }
bool isValid() const {
return (rNumber <= maxRunwayNumber ||
(rNumber == allRunwaysNumber && rDesignator == Designator::NONE) ||
(rNumber == messageRepetitionNumber && rDesignator == Designator::NONE));
}
bool isAllRunways() const {
return (rNumber == allRunwaysNumber && rDesignator == Designator::NONE);
}
bool isMessageRepetition() const {
return (rNumber == messageRepetitionNumber && rDesignator == Designator::NONE);
}
Runway() = default;
static inline std::optional<Runway> fromString(const std::string & s, bool enableRwy = false);
static Runway makeAllRunways() {
Runway rw;
rw.rNumber = allRunwaysNumber;
return rw;
}
private:
static inline std::optional<Designator> designatorFromChar(char c);
unsigned int rNumber = 0;
Designator rDesignator = Designator::NONE;
static const unsigned int allRunwaysNumber = 88;
static const unsigned int messageRepetitionNumber = 99;
static const auto maxRunwayNumber = 360 / 10;
};
class MetafTime {
public:
struct Date {
Date(unsigned int y, unsigned int m, unsigned int d) :
year(y), month(m), day(d) {}
unsigned int year;
unsigned int month;
unsigned int day;
};
std::optional<unsigned int> day() const { return dayValue; }
unsigned int hour() const { return hourValue; }
unsigned int minute() const { return minuteValue; }
inline bool isValid() const;
inline bool is3hourlyReportTime() const;
inline bool is6hourlyReportTime() const;
inline Date dateBeforeRef(const Date & refDate) const;
MetafTime() = default;
MetafTime(unsigned int hour, unsigned int minute) :
hourValue(hour), minuteValue(minute) {}
MetafTime(std::optional<unsigned int> day,
unsigned int hour,
unsigned int minute) :
dayValue(day), hourValue(hour), minuteValue(minute) {}
static inline std::optional<MetafTime> fromStringDDHHMM(const std::string & s);
static inline std::optional<MetafTime> fromStringDDHH(const std::string & s);
private:
std::optional<unsigned int> dayValue;
unsigned int hourValue = 0;
unsigned int minuteValue = 0;
static const inline unsigned int dayNotReported = 0;
static const inline unsigned int maxDay = 31;
static const inline unsigned int maxHour = 24;
static const inline unsigned int maxMinute = 59;
};
class Speed;
class Temperature {
public:
enum class Unit {
C,
F,
};
std::optional<float> temperature() const {
if (!tempValue.has_value()) return tempValue;
return (precise ?
(*tempValue * preciseValuePrecision) : *tempValue);
}
Unit unit() const { return tempUnit; }
std::optional<float> inline toUnit(Unit unit) const;
bool isFreezing() const { return freezing; }
bool isPrecise() const { return precise; }
bool isReported() const { return tempValue.has_value(); }
inline static std::optional<float> relativeHumidity(
const Temperature & airTemperature,
const Temperature & dewPoint);
inline static Temperature heatIndex(const Temperature & airTemperature,
float relativeHumidity);
inline static Temperature heatIndex(const Temperature & airTemperature,
const Temperature & dewPoint);
inline static Temperature windChill(const Temperature & airTemperature,
const Speed & windSpeed);
Temperature () = default;
static inline std::optional<Temperature> fromString(const std::string & s);
static inline std::optional<Temperature> fromRemarkString(const std::string & s);
private:
inline Temperature (float value);
std::optional<int> tempValue;
bool freezing = false;
static const Unit tempUnit = Unit::C;
bool precise = false; //True = tenth of degrees C, false = degrees C
static inline const float preciseValuePrecision = 0.1;
};
class Speed {
public:
enum class Unit {
KNOTS,
METERS_PER_SECOND,
KILOMETERS_PER_HOUR,
MILES_PER_HOUR
};
std::optional<unsigned int> speed() const { return speedValue; }
Unit unit() const { return speedUnit; }
std::optional<float> inline toUnit(Unit unit) const;
bool isReported() const { return speedValue.has_value(); }
Speed() = default;
static inline std::optional<Speed> fromString(const std::string & s, Unit unit);
static inline std::optional<Unit> unitFromString(const std::string & s);
private:
std::optional<unsigned int> speedValue;
Unit speedUnit = Unit::KNOTS;
static inline std::optional<float> knotsToUnit(float valueKnots, Unit otherUnit);
static inline std::optional<float> mpsToUnit(float valueMps, Unit otherUnit);
static inline std::optional<float> kmhToUnit(float valueKmh, Unit otherUnit);
static inline std::optional<float> mphToUnit(float valueMph, Unit otherUnit);
};
class Distance {
public:
enum class Unit {
METERS,
STATUTE_MILES,
FEET
};
enum class Modifier {
NONE,
LESS_THAN,
MORE_THAN,
DISTANT,
VICINITY
};
enum class MilesFraction {
NONE,
F_1_16,
F_1_8,
F_3_16,
F_1_4,
F_5_16,
F_3_8,
F_1_2,
F_5_8,
F_3_4,
F_7_8
};
inline std::optional<float> distance() const;
Unit unit() const { return distUnit; }
Modifier modifier() const { return distModifier; }
bool isValue() const { return (dist.has_value()); }
bool isReported() const {
return (isValue() ||
modifier() == Modifier::DISTANT ||
modifier() == Modifier::VICINITY);
}
inline std::optional<float> toUnit(Unit unit) const;
inline std::optional<std::pair<unsigned int, MilesFraction>> miles() const;
bool isValid() const { return true; }
Distance() = default;
Distance(unsigned int d, Unit u) :
dist (d * (u == Unit::STATUTE_MILES ? statuteMileFactor : 1)), distUnit(u) {}
Distance(unsigned int numerator, unsigned int denominator) {
if (!denominator) return;
dist = numerator * statuteMileFactor / denominator;
distUnit = Unit::STATUTE_MILES;
}
Distance(Unit u) : distUnit(u) {}
static inline std::optional<Distance> fromIntegerAndFraction(const Distance & integer,
const Distance & fraction);
static inline std::optional<Distance> fromMeterString(const std::string & s);
static inline std::optional<Distance> fromMileString(const std::string & s,
bool remarkFormat = false);
static inline std::optional<Distance> fromHeightString(const std::string & s);
static inline std::optional<Distance> fromRvrString(const std::string & s, bool unitFeet);
static inline std::optional< std::pair<Distance,Distance> > fromLayerString(
const std::string & s);
static inline Distance cavokVisibility(bool unitMiles = false);
static inline std::optional<Distance> fromKmString(const std::string & s);
static inline Distance makeDistant();
static inline Distance makeVicinity();
private:
Modifier distModifier = Modifier::NONE;
std::optional<unsigned int> dist;
Unit distUnit = Unit::METERS;
// If distance unit is statute mile, d stores value in 1/10000ths of mile
// This allows precision down to 1/16th (0.0625) mile without digit loss
static const unsigned int statuteMileFactor = 10000;
static const unsigned int heightFactor = 100; //height unit is 100s of feet
static const inline unsigned int cavokVisibilityMiles = 6;
static const inline unsigned int cavokVisibilityMeters = 10000;
// Icing or turbulence layer depth is given in 1000s of feet
static const unsigned int layerDepthFactor = 1000;
static inline std::optional<Modifier> modifierFromChar(char c);
static inline std::optional<float> metersToUnit(float value, Unit unit);
static inline std::optional<float> milesToUnit(float value, Unit unit);
static inline std::optional<float> feetToUnit(float value, Unit unit);
};
class Direction {
public:
enum class Type {
NOT_REPORTED, // Direction is specified as not reported
VARIABLE, // Direction is reported as variable
NDV, // Direction is reported as No Directional Variation
VALUE_DEGREES, // Direction is reported as value in degrees
VALUE_CARDINAL, // Direction is reported as cardinal value
OVERHEAD, // Phenomena occurring directly over the location
ALQDS, // Direction is reported as all quadrants (in all directions)
UNKNOWN // Direction is reported as unknown explicitly
};
enum class Cardinal {
NOT_REPORTED, // Not reported or no corresponding cardinal direction
VRB, // Direction is variable
NDV, // No Directional Variation
N,
S,
W,
E,
NW,
NE,
SW,
SE,
TRUE_N,
TRUE_W,
TRUE_S,
TRUE_E,
OHD, // Overhead
ALQDS, // All quadrants
UNKNOWN // Unknown
};
Type type() const { return dirType; }
inline Cardinal cardinal(bool trueDirections = false) const;
std::optional<unsigned int> degrees() const {
if (!isValue()) return std::optional<unsigned int>();
return dirDegrees;
}
bool isValue() const {
return (dirType == Type::VALUE_DEGREES || dirType == Type::VALUE_CARDINAL);
}
bool isReported() const { return (dirType != Type::NOT_REPORTED); }
static inline std::vector<Direction> sectorCardinalDirToVector(
const Direction & dirFrom,
const Direction & dirTo);
bool isValid() const {
if (isValue() && dirDegrees > maxDegrees) return false;
return true;
}
static inline Cardinal rotateOctantClockwise(Cardinal cardinal);
Direction() = default;
static inline std::optional<Direction> fromCardinalString(const std::string & s,
bool enableOhdAlqds = false,
bool enableUnknown = false);
static inline std::optional<Direction> fromDegreesString(const std::string & s);
static inline std::optional<std::pair<Direction, Direction>> fromSectorString(
const std::string & s);
private:
unsigned int dirDegrees = 0;
Type dirType = Type::NOT_REPORTED;
private:
static const inline unsigned int maxDegrees = 360;
static const inline unsigned int octantSize = 45u;
static const inline unsigned int degreesTrueNorth = 360;
static const inline unsigned int degreesTrueWest = 270;
static const inline unsigned int degreesTrueSouth = 180;
static const inline unsigned int degreesTrueEast = 90;
static const inline unsigned int degreesNorthWest = 315;
static const inline unsigned int degreesNorthEast = 45;
static const inline unsigned int degreesSouthWest = 225;
static const inline unsigned int degreesSouthEast = 135;
inline Direction(Cardinal c);
};
class Pressure {
public:
enum class Unit {
HECTOPASCAL,
INCHES_HG,
MM_HG
};
std::optional<float> pressure() const { return pressureValue; }
Unit unit() const { return pressureUnit; }
inline std::optional<float> toUnit(Unit unit) const;
bool isReported() const { return pressureValue.has_value(); }
Pressure() = default;
static inline std::optional<Pressure> fromString(const std::string & s);
static inline std::optional<Pressure> fromForecastString(const std::string & s);
static inline std::optional<Pressure> fromSlpString(const std::string & s);
static inline std::optional<Pressure> fromQfeString(const std::string & s);
static inline std::optional<Pressure> fromTendencyString(const std::string & s);
private:
std::optional<float> pressureValue;
Unit pressureUnit = Unit::HECTOPASCAL;
static inline const float inHgDecimalPointShift = 0.01;
static inline const float tendencyDecimalPointShift = 0.1;
};
class Precipitation {
public:
enum class Unit {
MM,
INCHES,
};
std::optional<float> amount() const { return precipValue; }
Unit unit() const { return precipUnit; }
inline std::optional<float> toUnit(Unit unit) const;
bool isReported() const { return precipValue.has_value(); }
Precipitation() = default;
static inline std::optional<Precipitation> fromRainfallString(const std::string & s);
static inline std::optional<Precipitation> fromRunwayDeposits(const std::string & s);
static inline std::optional<Precipitation> fromRemarkString(const std::string & s,
float factor = 1,
Unit unit = Unit::INCHES,
bool allowNotReported = false);
static inline std::optional<std::pair<Precipitation, Precipitation> >
fromSnincrString(const std::string & s);
private:
std::optional<float> precipValue;
Unit precipUnit = Unit::MM;
private:
// Special value for runway deposits depth, see Table 1079 in Manual on Codes (WMO No. 306).
enum Reserved {
RESERVED = 91,
DEPTH_10CM = 92,
DEPTH_15CM = 93,
DEPTH_20CM = 94,
DEPTH_25CM = 95,
DEPTH_30CM = 96,
DEPTH_35CM = 97,
DEPTH_40CM = 98,
RUNWAY_NOT_OPERATIONAL = 99
};
};
class SurfaceFriction {
public:
enum class Type {
NOT_REPORTED,
SURFACE_FRICTION_REPORTED,
BRAKING_ACTION_REPORTED,
UNRELIABLE // Value unreliable or unmeasurable.
};
enum class BrakingAction {
NONE, // Not reported or unreliable
POOR, // Friction coef <0.26
MEDIUM_POOR, // Friction coef 0.26 to 0.29
MEDIUM, // Friction coef 0.30 to 0.35
MEDIUM_GOOD, // Friction coef 0.36 to 0.39
GOOD, // Friction coef >0.39
};
Type type() const { return sfType; }
std::optional<float> coefficient() const {
if (sfType == Type::NOT_REPORTED ||
sfType == Type::UNRELIABLE) return std::optional<float>();
return (sfCoefficient * coefficientDecimalPointShift);
}
inline BrakingAction brakingAction() const;
bool isReported() const { return (type() != Type::NOT_REPORTED); }
bool isUnreliable() const { return (type() == Type::UNRELIABLE); }
SurfaceFriction() = default;
static inline std::optional<SurfaceFriction> fromString(const std::string & s);
private:
Type sfType = Type::NOT_REPORTED;
unsigned int sfCoefficient = 0; //0 to 100, multiply by 0.01 to get actual value
static const inline auto coefficientDecimalPointShift = 0.01;
private:
// Special values for braking action, see Table 0366 in Manual on Codes (WMO No. 306).
enum Reserved {
BRAKING_ACTION_POOR = 91,
BRAKING_ACTION_MEDIUM_POOR = 92,
BRAKING_ACTION_MEDIUM = 93,
BRAKING_ACTION_MEDIUM_GOOD = 94,
BRAKING_ACTION_GOOD = 95,
RESERVED_96 = 96,
RESERVED_97 = 97,
RESERVED_98 = 98,
UNRELIABLE = 99,
};
static const inline auto baPoorLowLimit = 0u;
static const inline auto baMediumPoorLowLimit = 26u;
static const inline auto baMediumLowLimit = 30u;
static const inline auto baMediumGoodLowLimit = 36u;
static const inline auto baGoodLowLimit = 40u;
};
class WaveHeight {
public:
enum class Type {
STATE_OF_SURFACE, // Descriptive state of surface is specified
WAVE_HEIGHT, // Actual wave height is specified
};
enum class Unit {
METERS,
FEET,
};
// State of sea surface, see Table 3700 in Manual on Codes (WMO No. 306).
enum class StateOfSurface {
NOT_REPORTED,
CALM_GLASSY,
CALM_RIPPLED,
SMOOTH,
SLIGHT,
MODERATE,
ROUGH,
VERY_ROUGH,
HIGH,
VERY_HIGH,
PHENOMENAL,
};
Type type() const { return whType; }
inline StateOfSurface stateOfSurface() const;
Unit unit() const { return whUnit; }
std::optional<float> waveHeight() const {
if (!whValue.has_value()) return std::optional<float>();
return (*whValue * waveHeightDecimalPointShift);
}
bool isReported() const { return whValue.has_value(); }
inline std::optional<float> toUnit(Unit unit) const;
WaveHeight() = default;
static inline std::optional<WaveHeight> fromString(const std::string & s);
private:
Type whType = Type::STATE_OF_SURFACE;
std::optional<unsigned int> whValue; //in decimeters, muliply by 0.1 to get value in meters
static const inline auto waveHeightDecimalPointShift = 0.1;
static const Unit whUnit = Unit::METERS;
private:
static inline std::optional<unsigned int> waveHeightFromStateOfSurfaceChar(char c);
private:
//Values below are in decimeters, muliply by 0.1 to get value in meters
static const inline auto maxWaveHeightCalmGlassy = 0;
static const inline auto maxWaveHeightCalmRippled = 1;
static const inline auto maxWaveHeightSmooth = 5;
static const inline auto maxWaveHeightSlight = 12;
static const inline auto maxWaveHeightModerate = 25;
static const inline auto maxWaveHeightRough = 40;
static const inline auto maxWaveHeightVeryRough = 60;
static const inline auto maxWaveHeightHigh = 90;
static const inline auto maxWaveHeightVeryHigh = 140;
static const inline auto minWaveHeightPhenomenal = 141;
};
// Describes recent, current, or forecast weather phenomena
class WeatherPhenomena {
public:
enum class Qualifier {
NONE,
RECENT,
VICINITY,
LIGHT,
MODERATE,
HEAVY
};
enum class Descriptor {
NONE,
SHALLOW,
PARTIAL,
PATCHES,
LOW_DRIFTING,
BLOWING,
SHOWERS,
THUNDERSTORM,
FREEZING
};
enum class Weather {
NOT_REPORTED,
DRIZZLE,
RAIN,
SNOW,
SNOW_GRAINS,
ICE_CRYSTALS,
ICE_PELLETS,
HAIL,
SMALL_HAIL,
UNDETERMINED,
MIST,
FOG,
SMOKE,
VOLCANIC_ASH,
DUST,
SAND,
HAZE,
SPRAY,
DUST_WHIRLS,
SQUALLS,
FUNNEL_CLOUD,
SANDSTORM,
DUSTSTORM
};
enum class Event {
NONE,
BEGINNING,
ENDING
};
inline Qualifier qualifier() const;
inline Descriptor descriptor() const;
inline std::vector<Weather> weather() const;
inline Event event() const;
std::optional<MetafTime> time() const { return tm; }
inline bool isValid() const;
WeatherPhenomena() = default;
static inline std::optional <WeatherPhenomena> fromString(const std::string & s,
bool enableQualifiers = false);
static inline std::optional <WeatherPhenomena> fromWeatherBeginEndString(
const std::string & s,
const MetafTime & reportTime,
const WeatherPhenomena & previous);
static WeatherPhenomena notReported(bool recent) {
const auto q = recent ? Qualifier::RECENT : Qualifier::NONE;
return WeatherPhenomena(Weather::NOT_REPORTED, Descriptor::NONE, q);
}
private:
// data contains qualifier, descriptor, event, 3 weather phenomena, and
// number of weather phenomena
// qualifier: 3 bits (6 options)
// descriptor: 4 bits (9 options)
// each weather phenomena: 5 bits (23 options)
// weather phenomena number: 2 bits (value 0 to 3)
// event: 2 bits (3 options)
// this optimisation is performed to keep WeatherPhenomena as small as
// possible and allow more weather events in groups
// such as RAE04RAB12E13DZB13E16RAB16E17DZB17E18RAB18E29DZB29E30
// without using std::vector so that WeatherPhenomena is copied easily
uint32_t data = 0;
static const inline size_t wSize = 3;
static const uint32_t qualifierMask = 0x7; // 3 bits
static const uint32_t qualifierShiftBits = 0;
static const uint32_t descriptorMask = 0x0f; // 4 bits
static const uint32_t descriptorShiftBits = 3;
static const uint32_t weatherMask = 0x1f; // 5 bits
static const uint32_t weather0ShiftBits = 3+4;
static const uint32_t weather1ShiftBits = 3+4+5;
static const uint32_t weather2ShiftBits = 3+4+5*2;
static const uint32_t weatherCountMask = 0x3; // 2 bits
static const uint32_t weatherCountShiftBits = 3+4+5*3;
static const uint32_t eventMask = 0x3; // 2 bits
static const uint32_t eventShiftBits = 3+4+5*3+2;
//Qualifier q = Qualifier::NONE;
//Descriptor d = Descriptor::NONE;
//static const inline size_t wSize = 3;
//size_t wsz = 0;
//Weather w[wSize] = {Weather::NOT_REPORTED, Weather::NOT_REPORTED, Weather::NOT_REPORTED};
//Event ev = Event::NONE;
std::optional<MetafTime> tm;
inline WeatherPhenomena(Weather w1,
Weather w2,
Descriptor d = Descriptor::NONE,
Qualifier q = Qualifier::NONE) : data (pack(q, d, 2, w1, w2)) {}
inline WeatherPhenomena(Weather w,
Descriptor d = Descriptor::NONE,
Qualifier q = Qualifier::NONE) : data (pack(q, d, 1, w)) {}
inline WeatherPhenomena(Descriptor d, Qualifier q = Qualifier::NONE) :
data(pack(q, d)) {}
static inline bool isDescriptorShAllowed (Weather w);
static inline bool isDescriptorTsAllowed (Weather w);
static inline bool isDescriptorFzAllowed (Weather w);
inline static uint32_t pack(Qualifier q = Qualifier::NONE,
Descriptor d = Descriptor::NONE,
size_t wNum = 0,
Weather w1 = Weather::NOT_REPORTED,
Weather w2 = Weather::NOT_REPORTED,
Weather w3 = Weather::NOT_REPORTED,
Event e = Event::NONE
);
inline static uint32_t pack(Qualifier q,
Descriptor d,
std::vector<Weather> w,
Event e = Event::NONE
);
// The following is to confirm that all enums cast to unsigned int
// fit into the specified amount of bits
static_assert(static_cast<uint32_t>(Qualifier::NONE) <= qualifierMask);
static_assert(static_cast<uint32_t>(Qualifier::RECENT) <= qualifierMask);
static_assert(static_cast<uint32_t>(Qualifier::VICINITY) <= qualifierMask);
static_assert(static_cast<uint32_t>(Qualifier::LIGHT) <= qualifierMask);
static_assert(static_cast<uint32_t>(Qualifier::MODERATE) <= qualifierMask);
static_assert(static_cast<uint32_t>(Qualifier::HEAVY) <= qualifierMask);
static_assert(static_cast<uint32_t>(Descriptor::NONE) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::SHALLOW) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::PARTIAL) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::PATCHES) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::LOW_DRIFTING) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::BLOWING) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::SHOWERS) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::THUNDERSTORM) <= descriptorMask);
static_assert(static_cast<uint32_t>(Descriptor::FREEZING) <= descriptorMask);
static_assert(static_cast<uint32_t>(Weather::NOT_REPORTED) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::DRIZZLE) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::RAIN) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SNOW) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SNOW_GRAINS) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::ICE_CRYSTALS) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::ICE_PELLETS) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::HAIL) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SMALL_HAIL) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::UNDETERMINED) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::MIST) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::FOG) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SMOKE) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::VOLCANIC_ASH) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::DUST) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SAND) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::HAZE) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SPRAY) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::DUST_WHIRLS) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SQUALLS) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::FUNNEL_CLOUD) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::SANDSTORM) <= weatherMask);
static_assert(static_cast<uint32_t>(Weather::DUSTSTORM) <= weatherMask);
static_assert(wSize <= weatherCountMask);
static_assert(static_cast<uint32_t>(Event::NONE) < eventMask);
static_assert(static_cast<uint32_t>(Event::BEGINNING) < eventMask);
static_assert(static_cast<uint32_t>(Event::ENDING) < eventMask);
};
class CloudType {
public:
enum class Type {
NOT_REPORTED,
//Low clouds
CUMULONIMBUS,
TOWERING_CUMULUS,
CUMULUS,
CUMULUS_FRACTUS,
STRATOCUMULUS,
NIMBOSTRATUS,
STRATUS,
STRATUS_FRACTUS,
//Med clouds
ALTOSTRATUS,
ALTOCUMULUS,
ALTOCUMULUS_CASTELLANUS,
//High clouds
CIRRUS,
CIRROSTRATUS,
CIRROCUMULUS,
//Obscurations
BLOWING_SNOW,
BLOWING_DUST,
BLOWING_SAND,
ICE_CRYSTALS,
RAIN,
DRIZZLE,
SNOW,
ICE_PELLETS,
SMOKE,
FOG,
MIST,
HAZE,
VOLCANIC_ASH
};
Type type() const { return tp; }
Distance height() const { return ht; }
unsigned int okta() const { return okt; }
bool isValid() const { return (okt >= 1u && okt <= 8u); }
CloudType() = default;
CloudType(Type t, Distance h, unsigned int o) : tp(t), ht(h), okt(o) {}
static inline std::optional<CloudType> fromString(const std::string & s);
static inline std::optional<CloudType> fromStringObscuration(const std::string & s);
private:
Type tp = Type::NOT_REPORTED;
Distance ht;
unsigned int okt = 0u;
static inline Type cloudTypeFromString(const std::string & s);
static inline Type cloudTypeOrObscurationFromString(const std::string & s);
};
///////////////////////////////////////////////////////////////////////////
enum class ReportType {
UNKNOWN,
METAR,
TAF
};
enum class ReportPart {
UNKNOWN,
HEADER,
METAR,
TAF,
RMK
};
enum class ReportError {
NONE,
EMPTY_REPORT,
EXPECTED_REPORT_TYPE_OR_LOCATION,
EXPECTED_LOCATION,
EXPECTED_REPORT_TIME,
EXPECTED_TIME_SPAN,
UNEXPECTED_REPORT_END,
UNEXPECTED_GROUP_AFTER_NIL,
UNEXPECTED_GROUP_AFTER_CNL,
UNEXPECTED_NIL_OR_CNL_IN_REPORT_BODY,
AMD_ALLOWED_IN_TAF_ONLY,
CNL_ALLOWED_IN_TAF_ONLY,
MAINTENANCE_INDICATOR_ALLOWED_IN_METAR_ONLY,
REPORT_TOO_LARGE
};
struct ReportMetadata {
ReportType type = ReportType::UNKNOWN;
ReportError error = ReportError::NONE;
std::optional<MetafTime> reportTime;
std::string icaoLocation;
bool isSpeci = false;
bool isNospeci = false;
bool isAutomated = false;
bool isAo1 = false;
bool isAo1a = false;
bool isAo2 = false;
bool isAo2a = false;
bool isNil = false;
bool isCancelled = false;
bool isAmended = false;
bool isCorrectional = false;
std::optional<unsigned int> correctionNumber = 0;
bool maintenanceIndicator = false;
std::optional<MetafTime> timeSpanFrom, timeSpanUntil;
};
static const inline ReportMetadata missingMetadata;
///////////////////////////////////////////////////////////////////////////
// Result of appending string to an existing group
enum class AppendResult {
// String was appended to the group (i.e. the string is a continuation of
// the previous group); all info from the string is already absorbed into
// the group; no need to parse the string.
// E.g. visibility group "1" will append string "1/2SM" since together
// they form visibility group "1 1/2SM".
APPENDED,
// String could not be appended to this group (i.e. the string is a
// separate group independent from last group); the parser must attempt
// to parse the string as a group
// E.g. group "BKN040" will not append string "22/20" since these two
// groups represent unrelated data (clouds and temperature).
NOT_APPENDED,
// The group expected particular string to follow and this expectation
// was not met; the group is not valid without the expected string and
// must be converted to raw string; the following string must still be
// attempted to be parsed.
// E.g. group "PK" expects next group string "WND", and if instead
// string "AO2" follows, it means that the original group "PK" is not
// valid and must be converted to raw string, whereas "AO2" may still
// represent a valid group and must be parsed separately.
GROUP_INVALIDATED
};
///////////////////////////////////////////////////////////////////////////
// Default delimiter between groups
// Note: only used to append raw strings, see also groupDelimiterRegex
static const inline char groupDelimiterChar = ' ';
// Everything after this char is ignored by parser
static const inline char reportEndChar = '=';
// Fallback group is the group which stores raw string in
// case when no other group is able to recognise the content
// (i.e. if anything else fails)
using FallbackGroup = UnknownGroup;
///////////////////////////////////////////////////////////////////////////
class KeywordGroup {
public:
enum class Type {
METAR,
SPECI,
TAF,
AMD,
NIL,
CNL,
COR,
AUTO,
CAVOK,
RMK,
MAINTENANCE_INDICATOR,
AO1,
AO2,
AO1A,
AO2A,
NOSPECI
};
Type type() const { return t; }
bool isValid() const { return (true); }
KeywordGroup() = default;
static inline std::optional<KeywordGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type t;
KeywordGroup(Type type) :t (type) {}
};
class LocationGroup {
public:
std::string toString() const {return std::string(location);}
inline bool isValid() const { return true; }
LocationGroup() = default;
static inline std::optional<LocationGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
static const inline auto locationLength = 4;
char location [locationLength + 1] = "\0";
};
class ReportTimeGroup {
public:
MetafTime time() const { return t; };
bool isValid() const { return (t.isValid() && t.day().has_value()); }
ReportTimeGroup() = default;
static inline std::optional<ReportTimeGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
MetafTime t;
};
class TrendGroup {
public:
enum class Type {
NOSIG,
BECMG,
TEMPO,
INTER,
FROM,
UNTIL,
AT,
TIME_SPAN,
PROB
};
enum class Probability {
NONE, // Probability not specified.
PROB_30,
PROB_40,
};
Type type() const { return t; }
Probability probability() const { return prob; }
std::optional<MetafTime> timeFrom() const { return tFrom; }
std::optional<MetafTime> timeUntil() const { return tTill; }
std::optional<MetafTime> timeAt() const { return tAt; }
bool isValid() const {
if (type() == Type::PROB) return false; //PROBxx without time span, BECMG, TEMPO, INTER
if (tFrom.has_value() && !tFrom->isValid()) return false;
if (tTill.has_value() && !tTill->isValid()) return false;
if (tAt.has_value() && !tAt->isValid()) return false;
return true;
}
inline bool isTimeSpanGroup() const;
TrendGroup() = default;
static inline std::optional<TrendGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
TrendGroup(Type type) : t(type) {}
TrendGroup(Probability p) : t(Type::PROB), prob(p) {}
static inline std::optional<TrendGroup> fromTimeSpan(const std::string & s);
static inline std::optional<TrendGroup> fromTimeSpanHHMM(const std::string & s);
static inline std::optional<TrendGroup> fromFm(const std::string & s);
static inline std::optional<TrendGroup> fromTrendTime(const std::string & s);
inline bool combineProbAndTrendTypeGroups(const TrendGroup & nextTrendGroup);
inline bool combineTrendTypeAndTimeGroup(const TrendGroup & nextTrendGroup);
inline bool combineProbAndTimeSpanGroups(const TrendGroup & nextTrendGroup);
inline bool combineIncompleteGroups(const TrendGroup & nextTrendGroup);
static inline bool canCombineTime(const TrendGroup & g1, const TrendGroup & g2);
inline void combineTime(const TrendGroup & nextTrendGroup);
inline bool isProbabilityGroup() const;
inline bool isTrendTypeGroup() const;
inline bool isTrendTimeGroup() const;
Type t = Type::NOSIG;
Probability prob = Probability::NONE;
bool isTafTimeSpanGroup = false;
std::optional<MetafTime> tFrom; // Time span beginning.
std::optional<MetafTime> tTill; // Time span end time.
std::optional<MetafTime> tAt; // Precise time.
};
class WindGroup {
public:
enum class Type {
SURFACE_WIND,
SURFACE_WIND_CALM,
VARIABLE_WIND_SECTOR,
SURFACE_WIND_WITH_VARIABLE_SECTOR,
WIND_SHEAR,
WIND_SHEAR_IN_LOWER_LAYERS,
WIND_SHIFT,
WIND_SHIFT_FROPA,
PEAK_WIND,
WSCONDS,
WND_MISG
};
Type type() const { return windType; }
Direction direction() const { return windDir; }
Speed windSpeed() const { return wSpeed; }
Speed gustSpeed() const { return gSpeed; }
Distance height() const { return wShHeight; }
Direction varSectorBegin() const { return vsecBegin; }
Direction varSectorEnd() const { return vsecEnd; }
std::optional<MetafTime> eventTime() const { return evTime; }
std::optional<Runway> runway() const { return rw; }
inline bool isValid() const;
WindGroup() = default;
static inline std::optional<WindGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
enum class IncompleteText {
NONE,
PK,
PK_WND,
WND,
WS,
WS_ALL
};
WindGroup(Type type, IncompleteText incomplete = IncompleteText::NONE) :
windType(type), incompleteText(incomplete) {}
static inline std::optional<WindGroup> parseVariableSector(
const std::string & group);
inline AppendResult appendPeakWind(const std::string & group,
const ReportMetadata & reportMetadata);
inline AppendResult appendWindShift(const std::string & group,
const ReportMetadata & reportMetadata);
inline AppendResult appendVariableSector(const std::string & group);
Type windType;
Direction windDir;
Speed wSpeed;
Speed gSpeed;
Distance wShHeight;
Direction vsecBegin;
Direction vsecEnd;
std::optional<MetafTime> evTime;
std::optional<Runway> rw;
IncompleteText incompleteText = IncompleteText::NONE;
};
class VisibilityGroup {
public:
enum class Type {
PREVAILING,
PREVAILING_NDV,
DIRECTIONAL,
RUNWAY,
RVR,
SURFACE,
TOWER,
SECTOR,
VARIABLE_PREVAILING,
VARIABLE_DIRECTIONAL,
VARIABLE_RUNWAY,
VARIABLE_RVR,
VARIABLE_SECTOR,
VIS_MISG,
RVR_MISG,
RVRNO,
VISNO
};
enum class Trend {
NONE,
NOT_REPORTED,
UPWARD,
NEUTRAL,
DOWNWARD
};
Type type() const { return visType; }
Distance visibility() const {
if (isVariable()) return Distance();
return vis;
}
Distance minVisibility() const {
if (!isVariable()) return Distance();
return vis;
}
Distance maxVisibility() const { return visMax; }
std::optional<Direction> direction() const { return dir; }
std::optional<Runway> runway() const { return rw; }
std::vector<Direction> sectorDirections() const {
return Direction::sectorCardinalDirToVector(
dirSecFrom.value_or(Direction()),
dirSecTo.value_or(Direction()));
}
Trend trend() const { return rvrTrend; }
inline bool isValid() const;
VisibilityGroup() = default;
inline static std::optional<VisibilityGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
enum class IncompleteText {
NONE,
INTEGER,
VIS,
VIS_INTEGER,
VIS_FRACTION_OR_METERS,
VIS_VAR_MAX_INT,
VIS_VAR,
VIS_DIR,
VIS_DIR_INTEGER,
VIS_DIR_VAR_MAX_INT,
SFC_OR_TWR,
SFC_OR_TWR_VIS,
SFC_OR_TWR_VIS_INTEGER,
RVR,
VISNO
};
inline VisibilityGroup(Type t, IncompleteText i) : visType(t), incompleteText(i) {}
bool isVariable() const {
switch (type()) {
case Type::VARIABLE_PREVAILING:
case Type::VARIABLE_DIRECTIONAL:
case Type::VARIABLE_RUNWAY:
case Type::VARIABLE_RVR:
case Type::VARIABLE_SECTOR:
return true;
default: return false;
}
}
void makeVariable() {
switch(visType) {
case Type::PREVAILING: visType = Type::VARIABLE_PREVAILING; break;
case Type::DIRECTIONAL: visType = Type::VARIABLE_DIRECTIONAL; break;
case Type::SECTOR: visType = Type::VARIABLE_SECTOR; break;
default: break;
}
}
static inline std::optional<VisibilityGroup> fromIncompleteInteger(const std::string & group);
static inline std::optional<VisibilityGroup> fromMeters(const std::string & group);
static inline std::optional<VisibilityGroup> fromRvr(const std::string & group);
inline bool appendFractionToIncompleteInteger(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendDirection(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendRunway(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendInteger(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendFraction(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendVariable(const std::string & group,
IncompleteText nextIfMaxIsInteger = IncompleteText::NONE,
IncompleteText nextIfMaxIsFraction = IncompleteText::NONE);
inline bool appendVariableMaxFraction(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendMeters(const std::string & group,
IncompleteText next = IncompleteText::NONE);
inline bool appendVariableMeters(const std::string & group,
IncompleteText next = IncompleteText::NONE);
static inline Trend trendFromString(const std::string & s);
Type visType = Type::PREVAILING;
Distance vis;
Distance visMax;
Trend rvrTrend = Trend::NONE;
std::optional<Direction> dir;
std::optional<Runway> rw;
std::optional<Direction> dirSecFrom;
std::optional<Direction> dirSecTo;
IncompleteText incompleteText = IncompleteText::NONE;
};
class CloudGroup {
public:
enum class Type {
NO_CLOUDS,
CLOUD_LAYER,
VERTICAL_VISIBILITY,
CEILING,
VARIABLE_CEILING,
CHINO,
CLD_MISG,
OBSCURATION
};
enum class Amount {
NOT_REPORTED,
NCD,
NSC,
NONE_CLR,
NONE_SKC,
FEW,
SCATTERED,
BROKEN,
OVERCAST,
OBSCURED,
VARIABLE_FEW_SCATTERED,
VARIABLE_SCATTERED_BROKEN,
VARIABLE_BROKEN_OVERCAST
};
enum class ConvectiveType {
NONE,
NOT_REPORTED,
TOWERING_CUMULUS,
CUMULONIMBUS
};
Type type() const { return tp; }
Amount amount() const { return amnt; }
ConvectiveType convectiveType() const { return convtype; }
inline Distance height() const {
if (type() != Type::CLOUD_LAYER &&
type() != Type::CEILING &&
type() != Type::OBSCURATION) return heightNotReported;
return heightOrVertVis;
}
inline Distance minHeight() const {
if (type() != Type::VARIABLE_CEILING) return heightNotReported;
return heightOrVertVis;
}
inline Distance maxHeight() const {
if (type() != Type::VARIABLE_CEILING) return heightNotReported;
return maxHt;
}
Distance verticalVisibility() const {
if (type() != Type::VERTICAL_VISIBILITY) return heightNotReported;
return heightOrVertVis;
}
inline std::optional<CloudType> cloudType() const;
std::optional<Runway> runway() const { return rw; }
std::optional<Direction> direction() const { return dir; }
bool isValid() const {
if (rw.has_value() && !rw->isValid()) return false;
if (dir.has_value() && !dir->isValid()) return false;
return (heightOrVertVis.isValid() && maxHt.isValid());
}
CloudGroup () = default;
static inline std::optional<CloudGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type tp = Type::CLOUD_LAYER;
Amount amnt = Amount::NOT_REPORTED;
Distance heightOrVertVis;
Distance maxHt;
ConvectiveType convtype = ConvectiveType::NONE;
WeatherPhenomena w;
std::optional<Runway> rw;
std::optional<Direction> dir;
CloudType cldTp;
static const inline auto heightNotReported = Distance(Distance::Unit::FEET);
enum class IncompleteText {
NONE,
RMK_AMOUNT,
RMK_AMOUNT_V,
CIG,
CIG_NUM,
CHINO,
CLD,
OBSCURATION
};
IncompleteText incompleteText = IncompleteText::NONE;
CloudGroup(Type t, IncompleteText it) : tp(t), incompleteText(it) {}
CloudGroup(Type t, Amount a = Amount::NOT_REPORTED) : tp(t), amnt(a) {}
static inline std::optional<CloudGroup> parseCloudLayerOrVertVis(const std::string & s);
static inline std::optional<CloudGroup> parseVariableCloudLayer(const std::string & s);
static inline std::optional<Amount> amountFromString(const std::string & s);
static inline std::optional<ConvectiveType> convectiveTypeFromString(const std::string & s);
inline AppendResult appendVariableCloudAmount(const std::string & group);
inline AppendResult appendCeiling(const std::string & group);
inline AppendResult appendRunwayOrCardinalDirection(const std::string & group);
inline AppendResult appendObscuration(const std::string & group);
static inline unsigned int amountToMaxOkta(Amount a);
static inline CloudType::Type convectiveTypeToCloudTypeType(ConvectiveType t);
};
class WeatherGroup {
public:
enum class Type {
CURRENT,
RECENT,
EVENT,
NSW,
PWINO,
WX_MISG,
TSNO,
TS_LTNG_TEMPO_UNAVBL
};
Type type() const { return t; }
inline std::vector<WeatherPhenomena> weatherPhenomena() const;
bool isValid() const {
if (incompleteText != IncompleteText::NONE) return false;
for (auto i=0u; i < wsz; i++)
if (!w[i].isValid()) return false;
return true;
}
WeatherGroup() = default;
static inline std::optional<WeatherGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
enum class IncompleteText {
NONE,
WX,
TSLTNG,
TSLTNG_TEMPO
};
inline bool addWeatherPhenomena(const WeatherPhenomena & wp);
Type t = Type::CURRENT;
static const inline size_t wSize = 20;
size_t wsz = 0;
WeatherPhenomena w[wSize];
IncompleteText incompleteText = IncompleteText::NONE;
WeatherGroup(Type tp, IncompleteText i = IncompleteText::NONE) : t(tp), incompleteText(i) {}
static inline WeatherGroup notReported();
static inline WeatherGroup notReportedRecent();
static inline std::optional<WeatherPhenomena> parseWeatherWithoutEvent(
const std::string & group,
ReportPart reportPart);
static inline std::optional<WeatherGroup> parseWeatherEvent(
const std::string & group,
const MetafTime & reportTime);
};
class TemperatureGroup {
public:
enum class Type {
TEMPERATURE_AND_DEW_POINT,
T_MISG,
TD_MISG
};
Type type() const { return tp; }
Temperature airTemperature() const { return t; }
Temperature dewPoint() const { return dp; }
std::optional<float> relativeHumidity() const {
return Temperature::relativeHumidity(airTemperature(), dewPoint());
}
inline bool isValid() const;
TemperatureGroup() = default;
static inline std::optional<TemperatureGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type tp = Type::TEMPERATURE_AND_DEW_POINT;
Temperature t;
Temperature dp;
bool isIncomplete = false;
TemperatureGroup(Type t, bool i = false) : tp(t), isIncomplete(i) {}
};
class PressureGroup {
public:
enum class Type {
OBSERVED_QNH, //Observed pressure normalised to sea level (altimeter setting)
FORECAST_LOWEST_QNH, //Forecast lowest sea level pressure
OBSERVED_QFE, //Observed actual (non-normalised) pressure
OBSERVED_SLP, //Observed pressure normailsed to sea level by more accurate calculation
SLPNO, //Mean sea-level pressure information is not available
PRES_MISG, //Atmospheric pressure (altimeter) data is missing
};
Type type() const { return t; }
Pressure atmosphericPressure() const { return p; }
bool isValid() const { return (!isIncomplete); }
PressureGroup() = default;
static inline std::optional<PressureGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type t = Type::OBSERVED_QNH;
Pressure p;
bool isIncomplete = false;
PressureGroup (Type tp, bool i = false) : t(tp), isIncomplete(i) {}
};
class RunwayStateGroup {
public:
enum class Type {
RUNWAY_STATE,
RUNWAY_CLRD,
RUNWAY_SNOCLO,
RUNWAY_NOT_OPERATIONAL,
AERODROME_SNOCLO
};
enum class Deposits {// Deposits type, see Table 0919 in Manual on Codes (WMO No. 306).
CLEAR_AND_DRY,
DAMP,
WET_AND_WATER_PATCHES,
RIME_AND_FROST_COVERED,
DRY_SNOW,
WET_SNOW,
SLUSH,
ICE,
COMPACTED_OR_ROLLED_SNOW,
FROZEN_RUTS_OR_RIDGES,
NOT_REPORTED
};
enum class Extent {// Extent of runway contamination, see Table 0519 in Manual on Codes (WMO No. 306).
NONE,
LESS_THAN_10_PERCENT,
FROM_11_TO_25_PERCENT,
RESERVED_3,
RESERVED_4,
FROM_26_TO_50_PERCENT,
RESERVED_6,
RESERVED_7,
RESERVED_8,
MORE_THAN_51_PERCENT,
NOT_REPORTED
};
Runway runway() const { return rw; }
Type type() const { return tp; }
Deposits deposits() const { return dp; }
Extent contaminationExtent() const { return ext; }
Precipitation depositDepth() const { return dDepth; }
SurfaceFriction surfaceFriction() const { return sf; }
bool isValid() const {
return (rw.isValid() &&
ext != Extent::RESERVED_3 &&
ext != Extent::RESERVED_4 &&
ext != Extent::RESERVED_6 &&
ext != Extent::RESERVED_7 &&
ext != Extent::RESERVED_8);
}
RunwayStateGroup() = default;
static inline std::optional<RunwayStateGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Runway rw;
Type tp = Type::RUNWAY_STATE;
Deposits dp = Deposits::NOT_REPORTED;
Extent ext = Extent::NOT_REPORTED;
Precipitation dDepth;
SurfaceFriction sf;
RunwayStateGroup(Type t, Runway r, SurfaceFriction s = SurfaceFriction()) :
rw(r), tp(t), sf(s) {}
static inline std::optional<Deposits> depositsFromString(const std::string & s);
static inline std::optional<Extent> extentFromString(const std::string & s);
};
class SeaSurfaceGroup {
public:
Temperature surfaceTemperature() const { return t; }
WaveHeight waves() const { return wh; }
bool isValid() const { return true; }
SeaSurfaceGroup() = default;
static inline std::optional<SeaSurfaceGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Temperature t;
WaveHeight wh;
};
class MinMaxTemperatureGroup {
public:
enum class Type {
OBSERVED_6_HOURLY,
OBSERVED_24_HOURLY,
FORECAST
};
Type type() const { return t; }
Temperature minimum() const { return minTemp; }
std::optional<MetafTime> minimumTime() const { return minTime; }
Temperature maximum() const { return maxTemp; }
std::optional<MetafTime> maximumTime() const { return maxTime; }
inline bool isValid() const;
MinMaxTemperatureGroup() = default;
static inline std::optional<MinMaxTemperatureGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type t = Type::FORECAST;
Temperature minTemp;
Temperature maxTemp;
std::optional<MetafTime> minTime;
std::optional<MetafTime> maxTime;
bool isIncomplete = false;
static inline std::optional<MinMaxTemperatureGroup> from6hourly(
const std::string & group);
static inline std::optional<MinMaxTemperatureGroup> from24hourly(
const std::string & group);
static inline std::optional<MinMaxTemperatureGroup> fromForecast(
const std::string & group);
inline AppendResult append6hourly(const std::string & group);
inline AppendResult appendForecast(const std::string & group);
};
class PrecipitationGroup {
public:
enum class Type {
TOTAL_PRECIPITATION_HOURLY,
SNOW_DEPTH_ON_GROUND,
FROZEN_PRECIP_3_OR_6_HOURLY,
FROZEN_PRECIP_3_HOURLY,
FROZEN_PRECIP_6_HOURLY,
FROZEN_PRECIP_24_HOURLY,
SNOW_6_HOURLY,
WATER_EQUIV_OF_SNOW_ON_GROUND,
ICE_ACCRETION_FOR_LAST_HOUR,
ICE_ACCRETION_FOR_LAST_3_HOURS,
ICE_ACCRETION_FOR_LAST_6_HOURS,
SNOW_INCREASING_RAPIDLY,
PRECIPITATION_ACCUMULATION_SINCE_LAST_REPORT,
RAINFALL_9AM_10MIN,
PNO,
FZRANO,
ICG_MISG,
PCPN_MISG,
};
Type type() const { return precType; }
Precipitation total() const { return precAmount; }
Precipitation recent() const { return precChange; }
bool isValid() const { return !isIncomplete; }
PrecipitationGroup() = default;
static inline std::optional<PrecipitationGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type precType = Type::TOTAL_PRECIPITATION_HOURLY;
Precipitation precAmount;
Precipitation precChange;
bool isIncomplete = false;
PrecipitationGroup(Type t, bool i = false) : precType(t), isIncomplete(i) {}
static inline float factorFromType(Type type);
static inline Precipitation::Unit unitFromType(Type type);
};
class LayerForecastGroup {
public:
enum class Type {
ICING_TRACE_OR_NONE,
ICING_LIGHT_MIXED,
ICING_LIGHT_RIME_IN_CLOUD,
ICING_LIGHT_CLEAR_IN_PRECIPITATION,
ICING_MODERATE_MIXED,
ICING_MODERATE_RIME_IN_CLOUD,
ICING_MODERATE_CLEAR_IN_PRECIPITATION,
ICING_SEVERE_MIXED,
ICING_SEVERE_RIME_IN_CLOUD,
ICING_SEVERE_CLEAR_IN_PRECIPITATION,
TURBULENCE_NONE,
TURBULENCE_LIGHT,
TURBULENCE_MODERATE_IN_CLEAR_AIR_OCCASIONAL,
TURBULENCE_MODERATE_IN_CLEAR_AIR_FREQUENT,
TURBULENCE_MODERATE_IN_CLOUD_OCCASIONAL,
TURBULENCE_MODERATE_IN_CLOUD_FREQUENT,
TURBULENCE_SEVERE_IN_CLEAR_AIR_OCCASIONAL,
TURBULENCE_SEVERE_IN_CLEAR_AIR_FREQUENT,
TURBULENCE_SEVERE_IN_CLOUD_OCCASIONAL,
TURBULENCE_SEVERE_IN_CLOUD_FREQUENT,
TURBULENCE_EXTREME,
};
Type type() const { return layerType; }
Distance baseHeight() const { return layerBaseHeight; }
Distance topHeight() const { return layerTopHeight; }
bool isValid() const { return true; }
LayerForecastGroup() = default;
static inline std::optional<LayerForecastGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type layerType;
Distance layerBaseHeight;
Distance layerTopHeight;
static inline std::optional<Type> typeFromStr(const std::string & s);
};
class PressureTendencyGroup {
public:
enum class Type {
NOT_REPORTED,
INCREASING_THEN_DECREASING,
INCREASING_MORE_SLOWLY,
INCREASING,
INCREASING_MORE_RAPIDLY,
STEADY,
DECREASING_THEN_INCREASING,
DECREASING_MORE_SLOWLY,
DECREASING,
DECREASING_MORE_RAPIDLY,
RISING_RAPIDLY,
FALLING_RAPIDLY
};
enum class Trend {
NOT_REPORTED,
HIGHER,
HIGHER_OR_SAME,
SAME,
LOWER_OR_SAME,
LOWER
};
Type type() const { return tendencyType; }
Pressure difference() const { return pressureDifference; }
static inline Trend trend(Type type);
bool isValid() const { return true; }
PressureTendencyGroup() = default;
static inline std::optional<PressureTendencyGroup> parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type tendencyType;
Pressure pressureDifference;
static inline std::optional<Type> typeFromChar(char type);
};
class CloudTypesGroup {
public:
inline std::vector<CloudType> cloudTypes() const;
inline bool isValid() const;
CloudTypesGroup() = default;
static inline std::optional<CloudTypesGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
size_t cldTpSize = 0;
inline static const size_t cldTpMaxSize = 8;
CloudType cldTp[cldTpMaxSize];
};
class LowMidHighCloudGroup {
public:
enum class LowLayer {
NONE,
CU_HU_CU_FR,
CU_MED_CU_CON,
CB_CAL,
SC_CUGEN,
SC_NON_CUGEN,
ST_NEB_ST_FR,
ST_FR_CU_FR_PANNUS,
CU_SC_NON_CUGEN_DIFFERENT_LEVELS,
CB_CAP,
NOT_OBSERVABLE
};
enum class MidLayer {
NONE,
AS_TR,
AS_OP_NS,
AC_TR,
AC_TR_LEN_PATCHES,
AC_TR_AC_OP_SPREADING,
AC_CUGEN_AC_CBGEN,
AC_DU_AC_OP_AC_WITH_AS_OR_NS,
AC_CAS_AC_FLO,
AC_OF_CHAOTIC_SKY,
NOT_OBSERVABLE
};
enum class HighLayer {
NONE,
CI_FIB_CI_UNC,
CI_SPI_CI_CAS_CI_FLO,
CI_SPI_CBGEN,
CI_FIB_CI_UNC_SPREADING,
CI_CS_LOW_ABOVE_HORIZON,
CI_CS_HIGH_ABOVE_HORIZON,
CS_NEB_CS_FIB_COVERING_ENTIRE_SKY,
CS,
CC,
NOT_OBSERVABLE
};
LowLayer lowLayer() const { return cloudLowLayer; }
MidLayer midLayer() const { return cloudMidLayer; }
HighLayer highLayer() const { return cloudHighLayer; }
inline bool isValid() const;
LowMidHighCloudGroup() = default;
static inline std::optional<LowMidHighCloudGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
LowLayer cloudLowLayer = LowLayer::NONE;
MidLayer cloudMidLayer = MidLayer::NONE;
HighLayer cloudHighLayer = HighLayer::NONE;
static inline LowLayer lowLayerFromChar(char c);
static inline MidLayer midLayerFromChar(char c);
static inline HighLayer highLayerFromChar(char c);
};
class LightningGroup {
public:
enum class Frequency {
NONE, // Not specified
OCCASIONAL, // Less than 1 flash/minute
FREQUENT, // 1 to 6 flashes/minute
CONSTANT // More than 6 flashes/minute
};
Frequency frequency() const { return freq; }
Distance distance() const { return dist; }
bool isCloudGround() const { return typeCloudGround; }
bool isInCloud() const { return typeInCloud; }
bool isCloudCloud() const { return typeCloudCloud; }
bool isCloudAir() const { return typeCloudAir; }
bool isUnknownType() const { return typeUnknown; }
inline std::vector<Direction> directions() const;
inline bool isValid() const { return !typeUnknown; }
LightningGroup() = default;
static inline std::optional<LightningGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
inline AppendResult append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Frequency freq = Frequency::NONE;
Distance dist;
bool typeCloudGround = false;
bool typeInCloud = false;
bool typeCloudCloud = false;
bool typeCloudAir = false;
bool typeUnknown = false;
std::optional<Direction> dir1from;
std::optional<Direction> dir1to;
std::optional<Direction> dir2from;
std::optional<Direction> dir2to;
bool incomplete = false;
LightningGroup(Frequency frequency) {
freq = frequency;
incomplete = true;
}
static inline std::optional<LightningGroup> fromLtgGroup(
const std::string & group);
bool isOmittedDir1() const { return (!dir1from.has_value() && !dir1to.has_value()); }
bool isOmittedDir2() const { return (!dir2from.has_value() && !dir2to.has_value()); }
};
class VicinityGroup {
public:
VicinityGroup() = default;
enum class Type {
THUNDERSTORM,
CUMULONIMBUS,
CUMULONIMBUS_MAMMATUS,
TOWERING_CUMULUS,
ALTOCUMULUS_CASTELLANUS,
STRATOCUMULUS_STANDING_LENTICULAR,
ALTOCUMULUS_STANDING_LENTICULAR,
CIRROCUMULUS_STANDING_LENTICULAR,
ROTOR_CLOUD,
VIRGA,
PRECIPITATION_IN_VICINITY,
FOG,
FOG_SHALLOW,
FOG_PATCHES,
HAZE,
SMOKE,
BLOWING_SNOW,
BLOWING_SAND,
BLOWING_DUST
};
Type type() const { return t; }
Distance distance() const { return dist; }
inline std::vector<Direction> directions() const;
inline Direction movingDirection() const { return movDir; }
inline bool isValid() const {
return (incompleteType == IncompleteType::NONE);
}
static inline std::optional<VicinityGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
inline AppendResult append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
Type t;
Distance dist;
std::optional<Direction> dir1from;
std::optional<Direction> dir1to;
std::optional<Direction> dir2from;
std::optional<Direction> dir2to;
Direction movDir;
enum class IncompleteType {
NONE, // Group complete
EXPECT_CLD, // ROTOR previously specified, now expecting CLD
EXPECT_DIST_DIR1, // Expect distance or first direction sector
EXPECT_DIR1, // Expect first direction sector
EXPECT_DIR2_MOV, // Expect second direction sector
EXPECT_DIR2, // Expect second direction sector
EXPECT_MOV, // Expect MOV
EXPECT_MOVDIR // Expect cardinal direction of movement
};
IncompleteType incompleteType = IncompleteType::NONE;
AppendResult expectNext(IncompleteType newType) {
incompleteType = newType; return AppendResult::APPENDED;
}
AppendResult finalise() {
incompleteType = IncompleteType::NONE;
return AppendResult::APPENDED;
}
AppendResult rejectGroup() {
incompleteType = IncompleteType::NONE;
return AppendResult::NOT_APPENDED;
}
VicinityGroup(Type tp) : t(tp) {
incompleteType = IncompleteType::EXPECT_DIST_DIR1;
if (type() == Type::ROTOR_CLOUD) incompleteType = IncompleteType::EXPECT_CLD;
}
inline bool appendDir1(const std::string & str);
inline bool appendDir2(const std::string & str);
inline bool appendDistance(const std::string & str);
};
class MiscGroup {
public:
enum class Type {
SUNSHINE_DURATION_MINUTES,
CORRECTED_WEATHER_OBSERVATION,
DENSITY_ALTITUDE,
HAILSTONE_SIZE,
COLOUR_CODE_BLUE_PLUS,
COLOUR_CODE_BLUE,
COLOUR_CODE_WHITE,
COLOUR_CODE_GREEN,
COLOUR_CODE_YELLOW,
COLOUR_CODE_YELLOW1,
COLOUR_CODE_YELLOW2,
COLOUR_CODE_AMBER,
COLOUR_CODE_RED,
COLOUR_CODE_BLACKBLUE_PLUS,
COLOUR_CODE_BLACKBLUE,
COLOUR_CODE_BLACKWHITE,
COLOUR_CODE_BLACKGREEN,
COLOUR_CODE_BLACKYELLOW,
COLOUR_CODE_BLACKYELLOW1,
COLOUR_CODE_BLACKYELLOW2,
COLOUR_CODE_BLACKAMBER,
COLOUR_CODE_BLACKRED,
FROIN,
ISSUER_ID_FS,
ISSUER_ID_FN
};
Type type() const { return groupType; }
std::optional<float> data() const { return groupData; }
inline bool isValid() const;
MiscGroup() = default;
static inline std::optional<MiscGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata);
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata);
private:
enum class IncompleteText {
NONE,
DENSITY,
DENSITY_ALT,
GR,
GR_INT
};
Type groupType;
std::optional<float> groupData;
IncompleteText incompleteText = IncompleteText::NONE;
inline static std::optional<Type> parseColourCode(const std::string & group);
inline bool appendHailstoneFraction (const std::string & group);
inline bool appendDensityAltitude (const std::string & group);
};
class UnknownGroup {
public:
UnknownGroup() = default;
static std::optional<UnknownGroup> parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata = missingMetadata)
{
(void)group; (void)reportPart; (void)reportMetadata;
return UnknownGroup();
}
AppendResult inline append(const std::string & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const ReportMetadata & reportMetadata = missingMetadata)
{
(void)group; (void)reportPart; (void)reportMetadata;
return AppendResult::APPENDED;
}
bool isValid() const { return true; }
};
///////////////////////////////////////////////////////////////////////////////
struct GroupInfo {
GroupInfo(Group g, ReportPart rp, std::string rawstr) :
group(std::move(g)), reportPart(rp), rawString(std::move(rawstr)) {}
Group group;
ReportPart reportPart;
std::string rawString;
};
///////////////////////////////////////////////////////////////////////////////
// Syntax Group is a delimiter of structural part of METAR/TAF report
enum class SyntaxGroup {
OTHER, // Group is not important for report syntax
METAR, // Keyword METAR (beginning of METAR report)
SPECI, // Keyword SPECI (beginning of METAR report)
TAF, // Keyword TAF (beginning of TAF report)
COR, // Keyword COR (correctional report)
AMD, // Keyword AMD (amended report)
LOCATION, // ICAO location, 4 alphanumeric chars, 1st char must be alpha
REPORT_TIME, // Report release time, 6 digits and letter Z (xxxxxxZ)
TIME_SPAN, // TAF report validity time (xxxx/xxxx)
CNL, // Keyword CNL (cancelled report)
NIL, // Keyword NIL (missing report)
RMK, // Keyword RMK (remarks to follow)
MAINTENANCE_INDICATOR //Keyword $ added at the end of automated METARs
};
// Determines groups important for report syntax
inline SyntaxGroup getSyntaxGroup(const Group & group);
///////////////////////////////////////////////////////////////////////////////
class GroupParser {
public:
static Group parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
return parseAlternative<0>(group, reportPart, reportMetadata);
}
static Group reparse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata,
const Group & previous)
{
return reparseAlternative<0>(group, reportPart, reportMetadata, previous.index());
}
private:
template <size_t I>
static Group parseAlternative(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
using Alternative = std::variant_alternative_t<I, Group>;
if constexpr (!std::is_same<Alternative, FallbackGroup>::value) {
const auto parsed = Alternative::parse(group, reportPart, reportMetadata);
if (parsed.has_value()) return *parsed;
}
if constexpr (I >= (std::variant_size_v<Group> - 1)) {
return FallbackGroup();
} else {
return parseAlternative<I+1>(group, reportPart, reportMetadata);
}
}
template <size_t I>
static Group reparseAlternative(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata,
size_t ignoreIndex)
{
using Alternative = std::variant_alternative_t<I, Group>;
if constexpr (!std::is_same<Alternative, FallbackGroup>::value) {
if (I != ignoreIndex) {
const auto parsed = Alternative::parse(group, reportPart, reportMetadata);
if (parsed.has_value()) return *parsed;
}
}
if constexpr (I >= (std::variant_size_v<Group> - 1)) {
return FallbackGroup();
} else {
return reparseAlternative<I+1>(group, reportPart, reportMetadata, ignoreIndex);
}
}
};
struct ParseResult {
ReportMetadata reportMetadata;
std::vector<GroupInfo> groups;
};
class Parser {
public:
static inline ParseResult parse (const std::string & report, size_t groupLimit = 200);
private:
static inline bool appendToLastResultGroup(ParseResult & result,
const std::string & groupStr,
ReportPart reportPart,
const ReportMetadata & reportMetadata,
bool allowReparse = true);
static inline void addGroupToResult(ParseResult & result,
Group group,
ReportPart reportPart,
std::string groupString);
static inline void updateMetadata(const Group & group,
ReportMetadata & reportMetadata);
class ReportInput {
public:
ReportInput(const std::string & s) : report(s) {}
friend ReportInput & operator >> (ReportInput & input, std::string & output) {
output = input.getNextGroup();
return input;
}
private:
inline std::string getNextGroup();
const std::string & report;
bool finished = false;
size_t pos = 0;
};
class Status {
public:
Status() :
state(State::REPORT_TYPE_OR_LOCATION),
reportType(ReportType::UNKNOWN),
reportError(ReportError::NONE) {}
ReportType getReportType() { return reportType; }
ReportError getError() { return reportError; }
bool isError() { return (reportError != ReportError::NONE); }
inline ReportPart getReportPart();
inline void transition(SyntaxGroup group);
inline void finalTransition();
bool isReparseRequired() {
return (state == State::REPORT_BODY_BEGIN_METAR_REPEAT_PARSE);
}
void setError(ReportError e) { state = State::ERROR; reportError = e; }
private:
enum class State {
// States of state machine used to check syntax of METAR/TAF reports
REPORT_TYPE_OR_LOCATION,
CORRECTION,
LOCATION,
REPORT_TIME,
TIME_SPAN,
REPORT_BODY_BEGIN_METAR,
REPORT_BODY_BEGIN_METAR_REPEAT_PARSE,
REPORT_BODY_METAR,
REPORT_BODY_BEGIN_TAF,
REPORT_BODY_TAF,
REMARK_METAR,
REMARK_TAF,
NIL,
CNL,
ERROR
};
void setState(State s) { state = s; }
void setReportType(ReportType rt) { reportType = rt; }
inline void transitionFromReportTypeOrLocation(SyntaxGroup group);
inline void transitionFromCorrecton(SyntaxGroup group);
inline void transitionFromReportTime(SyntaxGroup group);
inline void transitionFromTimeSpan(SyntaxGroup group);
inline void transitionFromReportBodyBeginMetar(SyntaxGroup group);
inline void transitionFromReportBodyMetar(SyntaxGroup group);
inline void transitionFromReportBodyBeginTaf(SyntaxGroup group);
inline void transitionFromReportBodyTaf(SyntaxGroup group);
State state;
ReportType reportType;
ReportError reportError;
};
};
///////////////////////////////////////////////////////////////////////////////
template <typename T>
class Visitor {
public:
inline T visit(const Group & group,
ReportPart reportPart = ReportPart::UNKNOWN,
const std::string & rawString = std::string());
inline T visit(const GroupInfo & groupInfo) {
return visit(groupInfo.group, groupInfo.reportPart, groupInfo.rawString);
}
protected:
virtual T visitKeywordGroup(
const KeywordGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitLocationGroup(const LocationGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitReportTimeGroup(const ReportTimeGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitTrendGroup(const TrendGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitWindGroup(const WindGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitVisibilityGroup(const VisibilityGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitCloudGroup(const CloudGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitWeatherGroup(const WeatherGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitTemperatureGroup(const TemperatureGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitPressureGroup(const PressureGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitRunwayStateGroup(const RunwayStateGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitSeaSurfaceGroup(const SeaSurfaceGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitMinMaxTemperatureGroup(const MinMaxTemperatureGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitPrecipitationGroup(const PrecipitationGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitLayerForecastGroup(const LayerForecastGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitPressureTendencyGroup(const PressureTendencyGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitCloudTypesGroup(const CloudTypesGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitLowMidHighCloudGroup(const LowMidHighCloudGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitLightningGroup(const LightningGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitVicinityGroup(const VicinityGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitMiscGroup(const MiscGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
virtual T visitUnknownGroup(const UnknownGroup & group,
ReportPart reportPart,
const std::string & rawString) = 0;
};
template <typename T>
inline T Visitor<T>::visit(const Group & group,
ReportPart reportPart,
const std::string & rawString)
{
if (const auto gr = std::get_if<KeywordGroup>(&group); gr) {
return this->visitKeywordGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<LocationGroup>(&group); gr) {
return this->visitLocationGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<ReportTimeGroup>(&group); gr) {
return this->visitReportTimeGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<TrendGroup>(&group); gr) {
return this->visitTrendGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<WindGroup>(&group); gr) {
return this->visitWindGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<VisibilityGroup>(&group); gr) {
return this->visitVisibilityGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<CloudGroup>(&group); gr) {
return this->visitCloudGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<WeatherGroup>(&group); gr) {
return this->visitWeatherGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<TemperatureGroup>(&group); gr) {
return this->visitTemperatureGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<PressureGroup>(&group); gr) {
return this->visitPressureGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<RunwayStateGroup>(&group); gr) {
return this->visitRunwayStateGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<SeaSurfaceGroup>(&group); gr) {
return this->visitSeaSurfaceGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<MinMaxTemperatureGroup>(&group); gr) {
return this->visitMinMaxTemperatureGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<PrecipitationGroup>(&group); gr) {
return this->visitPrecipitationGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<LayerForecastGroup>(&group); gr) {
return this->visitLayerForecastGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<PressureTendencyGroup>(&group); gr) {
return this->visitPressureTendencyGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<CloudTypesGroup>(&group); gr) {
return this->visitCloudTypesGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<LowMidHighCloudGroup>(&group); gr) {
return this->visitLowMidHighCloudGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<LightningGroup>(&group); gr) {
return this->visitLightningGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<VicinityGroup>(&group); gr) {
return this->visitVicinityGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<MiscGroup>(&group); gr) {
return this->visitMiscGroup(*gr, reportPart, rawString);
}
if (const auto gr = std::get_if<UnknownGroup>(&group); gr) {
return this->visitUnknownGroup(*gr, reportPart, rawString);
}
return T();
}
template<>
inline void Visitor<void>::visit(const Group & group,
ReportPart reportPart,
const std::string & rawString)
{
if (const auto gr = std::get_if<KeywordGroup>(&group); gr) {
this->visitKeywordGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<LocationGroup>(&group); gr) {
this->visitLocationGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<ReportTimeGroup>(&group); gr) {
this->visitReportTimeGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<TrendGroup>(&group); gr) {
this->visitTrendGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<WindGroup>(&group); gr) {
this->visitWindGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<VisibilityGroup>(&group); gr) {
this->visitVisibilityGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<CloudGroup>(&group); gr) {
this->visitCloudGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<WeatherGroup>(&group); gr) {
this->visitWeatherGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<TemperatureGroup>(&group); gr) {
this->visitTemperatureGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<PressureGroup>(&group); gr) {
this->visitPressureGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<RunwayStateGroup>(&group); gr) {
this->visitRunwayStateGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<SeaSurfaceGroup>(&group); gr) {
this->visitSeaSurfaceGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<MinMaxTemperatureGroup>(&group); gr) {
this->visitMinMaxTemperatureGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<PrecipitationGroup>(&group); gr) {
this->visitPrecipitationGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<LayerForecastGroup>(&group); gr) {
this->visitLayerForecastGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<PressureTendencyGroup>(&group); gr) {
this->visitPressureTendencyGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<CloudTypesGroup>(&group); gr) {
this->visitCloudTypesGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<LowMidHighCloudGroup>(&group); gr) {
this->visitLowMidHighCloudGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<LightningGroup>(&group); gr) {
this->visitLightningGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<VicinityGroup>(&group); gr) {
this->visitVicinityGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<MiscGroup>(&group); gr) {
this->visitMiscGroup(*gr, reportPart, rawString);
return;
}
if (const auto gr = std::get_if<UnknownGroup>(&group); gr) {
this->visitUnknownGroup(*gr, reportPart, rawString);
return;
}
}
template<>
inline void Visitor<void>::visit(const GroupInfo & groupInfo) {
visit(groupInfo.group, groupInfo.reportPart, groupInfo.rawString);
}
///////////////////////////////////////////////////////////////////////////////
inline std::optional<unsigned int> strToUint(const std::string & str,
std::size_t startPos,
std::size_t digits);
inline std::optional<std::pair<unsigned int, unsigned int> > fractionStrToUint(
const std::string & str,
std::size_t startPos,
std::size_t length);
} //namespace metaf
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
namespace metaf {
std::optional<unsigned int> strToUint(const std::string & str,
std::size_t startPos,
std::size_t digits)
{
std::optional<unsigned int> error;
if (str.empty() || !digits || startPos + digits > str.length()) return error;
unsigned int value = 0;
for (auto [i,c] = std::pair(0u, str.c_str() + startPos); i < digits; i++, c++) {
if (*c < '0' || *c > '9') return error;
static const auto decimalRadix = 10u;
value = value * decimalRadix + (*c - '0');
}
return value;
}
std::optional<std::pair<unsigned int, unsigned int> >
fractionStrToUint(const std::string & str,
std::size_t startPos,
std::size_t length)
{
//Equivalent regex "(\\d\\d?)/(\\d\\d?)"
std::optional<std::pair<unsigned int, unsigned int> > error;
if (length + startPos > str.length()) length = str.length() - startPos;
const int endPos = startPos + length;
const auto slashPos = str.find('/', startPos);
if (slashPos == std::string::npos) return error;
static const int minDigits = 1, maxDigits = 2;
const int numeratorPos = startPos;
const int numeratorLength = slashPos - startPos;
if (numeratorLength < minDigits || numeratorLength > maxDigits) return error;
const int denominatorPos = slashPos + 1;
const int denominatorLength = endPos - denominatorPos;
if (denominatorLength < minDigits || denominatorLength > maxDigits) return error;
const auto numerator = strToUint(str, numeratorPos, numeratorLength);
const auto denominator = strToUint(str, denominatorPos, denominatorLength);
if (!numerator.has_value() || !denominator.has_value()) return error;
return std::pair(*numerator, *denominator);
}
std::optional<Runway> Runway::fromString(const std::string & s, bool enableRwy) {
//static const std::regex rgx("R(?:WY)?(\\d\\d)([RLC])?");
static const std::optional<Runway> error;
if (s.length() < 3) return error;
if (s[0] != 'R') return error;
auto numPos = 1u;
if (enableRwy && s[1] == 'W' && s[2] == 'Y') numPos += 2;
const auto rwyNum = strToUint(s, numPos, 2);
if (!rwyNum.has_value()) return error;
const auto dsgPos = numPos + 2;
if (s.length() > dsgPos + 1) return error;
Runway runway;
runway.rNumber = *rwyNum;
if ( s.length() > dsgPos) {
const auto designator = designatorFromChar(s[dsgPos]);
if (!designator.has_value()) return error;
runway.rDesignator = *designator;
}
return runway;
}
std::optional<Runway::Designator> Runway::designatorFromChar(char c) {
switch (c) {
case 'R': return Designator::RIGHT;
case 'C': return Designator::CENTER;
case 'L': return Designator::LEFT;
default: return std::optional<Designator>();
}
}
///////////////////////////////////////////////////////////////////////////////
bool MetafTime::is3hourlyReportTime() const {
switch(hour()) {
case 2: case 3: case 8: case 9: case 14: case 15: case 20: case 21: return true;
default: return false;
}
}
bool MetafTime::is6hourlyReportTime() const {
switch(hour()) {
case 0: case 5: case 6: case 11: case 12: case 17: case 18: case 23: return true;
default: return false;
}
}
MetafTime::Date MetafTime::dateBeforeRef(const Date & refDate) const {
if (!day().has_value()) return refDate;
Date result = refDate;
result.day = *day();
if (result.day > refDate.day) { //previous month
static const auto firstMonth = 1;
static const auto lastMonth = 12;
if (result.month == firstMonth) {
result.year--;
result.month = lastMonth;
} else {
result.month--;
}
}
return result;
}
std::optional<MetafTime> MetafTime::fromStringDDHHMM(const std::string & s) {
//static const std::regex rgx ("(\\d\\d)?(\\d\\d)(\\d\\d)");
static const std::optional<MetafTime> error;
if (s.length() == 4) {
const auto hour = strToUint(s, 0, 2);
const auto minute = strToUint(s, 2, 2);
if (!hour.has_value() || !minute.has_value()) return error;
MetafTime metafTime;
metafTime.hourValue = *hour;
metafTime.minuteValue = *minute;
return metafTime;
}
if (s.length() == 6) {
const auto day = strToUint(s, 0, 2);
const auto hour = strToUint(s, 2, 2);
const auto minute = strToUint(s, 4, 2);
if (!day.has_value() || !hour.has_value() || !minute.has_value()) return error;
MetafTime metafTime;
metafTime.dayValue = day;
metafTime.hourValue = *hour;
metafTime.minuteValue = *minute;
return metafTime;
}
return error;
}
std::optional<MetafTime> MetafTime::fromStringDDHH(const std::string & s) {
//static const std::regex rgx ("(\\d\\d)(\\d\\d)");
static const std::optional<MetafTime> error;
if (s.length() != 4) return error;
const auto day = strToUint(s, 0, 2);
const auto hour = strToUint(s, 2, 2);
if (!day.has_value() || !hour.has_value()) return error;
MetafTime metafTime;
metafTime.dayValue = day;
metafTime.hourValue = *hour;
return metafTime;
}
bool MetafTime::isValid() const {
if (auto d = dayValue.value_or(maxDay); d > maxDay || !d) return false;
if (hourValue > maxHour) return false;
if (minuteValue > maxMinute) return false;
return true;
}
///////////////////////////////////////////////////////////////////////////////
Temperature::Temperature(float value) :
tempValue(std::round(value * 10.0)), freezing(value < 0), precise(true) {}
std::optional<float> Temperature::relativeHumidity(
const Temperature & airTemperature,
const Temperature & dewPoint)
{
const auto temperatureC = airTemperature.toUnit(Temperature::Unit::C);
const auto dewPointC = dewPoint.toUnit(Temperature::Unit::C);
if (!temperatureC.has_value() || !dewPointC.has_value()) {
return std::optional<float>();
}
if (*temperatureC < *dewPointC) return 100.0;
const auto saturationVapourPressure =
6.11 * pow(10, 7.5 * *temperatureC / (237.7 + *temperatureC));
const auto actualVapourPressure =
6.11 * pow(10, 7.5 * *dewPointC / (237.7 + *dewPointC));
return (100.0 * actualVapourPressure / saturationVapourPressure);
}
Temperature Temperature::heatIndex(
const Temperature & airTemperature,
float relativeHumidity)
{
// Using formula from https://en.wikipedia.org/wiki/Heat_index
// (see formula for degrees Celsius)
// The formula is valid for temperature > 27 C and RH > 40%
const auto temperatureC = airTemperature.toUnit(Temperature::Unit::C);
if (!temperatureC.has_value() || temperatureC <27.0) return Temperature();
if (relativeHumidity > 100.0 || relativeHumidity < 40.0) return Temperature();
const auto c1 = -8.78469475556;
const auto c2 = 1.61139411;
const auto c3 = 2.33854883889;
const auto c4 = -0.14611605;
const auto c5 = -0.012308094;
const auto c6 = -0.0164248277778;
const auto c7 = 0.002211732;
const auto c8 = 0.00072546;
const auto c9 = -0.000003582;
const auto t = *temperatureC, r = relativeHumidity;
const auto heatIndexC =
c1 + c2 * t + c3 * r + c4 * t * r +
c5 * t * t + c6 * r * r +
c7 * t * t * r + c8 * t * r * r + c9 * t * t * r * r;
return Temperature(heatIndexC);
}
Temperature Temperature::heatIndex(
const Temperature & airTemperature,
const Temperature & dewPoint)
{
const auto rh = relativeHumidity(airTemperature, dewPoint);
if (!rh.has_value()) return Temperature();
return heatIndex(airTemperature, *rh);
}
Temperature Temperature::windChill(
const Temperature & airTemperature,
const Speed & windSpeed)
{
const auto temperatureC = airTemperature.toUnit(Temperature::Unit::C);
if (!temperatureC.has_value() || *temperatureC > 10.0) return Temperature();
const auto windKmh = windSpeed.toUnit(Speed::Unit::KILOMETERS_PER_HOUR);
if (!windKmh.has_value() || *windKmh < 4.8) return Temperature();
const auto windChillC =
13.12 +
0.6215 * *temperatureC -
11.37 * pow(*windKmh, 0.16) +
0.3965 * *temperatureC * pow(*windKmh, 0.16);
return Temperature(windChillC);
}
std::optional<Temperature> Temperature::fromString(const std::string & s) {
//static const std::regex rgx ("(?:(M)?(\\d\\d))|//");
std::optional<Temperature> error;
if (s == "//") return Temperature();
if (s.length() == 3) {
if (s[0] != 'M') return error;
const auto t = strToUint(s, 1, 2);
if (!t.has_value()) return error;
Temperature temperature;
temperature.tempValue = - *t;
temperature.freezing = true;
return temperature;
}
if (s.length() == 2) {
const auto t = strToUint(s, 0, 2);
if (!t.has_value()) return error;
Temperature temperature;
temperature.tempValue = *t;
return temperature;
}
return error;
}
std::optional<Temperature> Temperature::fromRemarkString(const std::string & s) {
//static const std::regex ("([01])(\\d\\d\\d)");
std::optional<Temperature> error;
if (s.length() != 4) return error;
if (s[0] != '0' && s[0] != '1') return error;
const auto t = strToUint(s, 1, 3);
if (!t.has_value()) return error;
int tValueSigned = *t;
if (s[0] == '1') tValueSigned = -tValueSigned;
return Temperature(tValueSigned / 10.0);
}
std::optional<float> Temperature::toUnit(Unit unit) const {
std::optional<float> error;
auto v = temperature();
if (!v.has_value() || tempUnit != Unit::C) return error;
switch (unit) {
case Unit::C: return *v;
case Unit::F: return (*v * 1.8 + 32);
}
}
///////////////////////////////////////////////////////////////////////////////
std::optional<Speed> Speed::fromString(const std::string & s, Unit unit) {
//static const std::regex rgx ("([1-9]?\\d\\d)|//");
static const std::optional<Speed> error;
if (s.empty() || s == "//") return Speed();
if (s.length() != 2 && s.length() != 3) return error;
if (s.length() == 3 && s[0] == '0') return error;
const auto spd = strToUint(s, 0, s.length());
if (!spd.has_value()) return error;
Speed speed;
speed.speedUnit = unit;
speed.speedValue = *spd;
return speed;
}
std::optional<float> Speed::toUnit(Unit unit) const {
if (!speedValue.has_value()) return std::optional<float>();
switch (speedUnit) {
case Unit::KNOTS: return knotsToUnit(*speedValue, unit);
case Unit::METERS_PER_SECOND: return mpsToUnit(*speedValue, unit);
case Unit::KILOMETERS_PER_HOUR: return kmhToUnit(*speedValue, unit);
case Unit::MILES_PER_HOUR: return mphToUnit(*speedValue, unit);
default: return std::optional<float>();
}
}
std::optional<Speed::Unit> Speed::unitFromString(const std::string & s) {
if (s == "KT") return Speed::Unit::KNOTS;
if (s == "MPS") return Speed::Unit::METERS_PER_SECOND;
if (s == "KMH") return Speed::Unit::KILOMETERS_PER_HOUR;
return std::optional<Speed::Unit>();
}
std::optional<float> Speed::knotsToUnit(float valueKnots, Unit otherUnit) {
switch(otherUnit) {
case Unit::KNOTS: return valueKnots;
case Unit::METERS_PER_SECOND: return (valueKnots * 0.514444);
case Unit::KILOMETERS_PER_HOUR: return (valueKnots * 1.852);
case Unit::MILES_PER_HOUR: return (valueKnots * 1.150779);
default: return std::optional<float>();
}
}
std::optional<float> Speed::mpsToUnit(float valueMps, Unit otherUnit) {
switch(otherUnit) {
case Unit::KNOTS: return (valueMps * 1.943844);
case Unit::METERS_PER_SECOND: return valueMps;
case Unit::KILOMETERS_PER_HOUR: return (valueMps * 3.6);
case Unit::MILES_PER_HOUR: return (valueMps * 2.236936);
default: return std::optional<float>();
}
}
std::optional<float> Speed::kmhToUnit(float valueKmh, Unit otherUnit) {
switch(otherUnit) {
case Unit::KNOTS: return (valueKmh / 1.852);
case Unit::METERS_PER_SECOND: return (valueKmh / 3.6);
case Unit::KILOMETERS_PER_HOUR: return valueKmh;
case Unit::MILES_PER_HOUR: return (valueKmh * 0.621371);
default: return std::optional<float>();
}
}
std::optional<float> Speed::mphToUnit(float valueMph, Unit otherUnit) {
switch(otherUnit) {
case Unit::KNOTS: return (valueMph * 0.868976);
case Unit::METERS_PER_SECOND: return (valueMph * 0.44704);
case Unit::KILOMETERS_PER_HOUR: return (valueMph * 1.609344);
case Unit::MILES_PER_HOUR: return valueMph;
default: return std::optional<float>();
}
}
////////////////////////////////////////////////////////////////////////////////
std::optional<Distance> Distance::fromMeterString(const std::string & s) {
//static const std::regex rgx ("(\\d\\d\\d\\d)|////");
static const std::optional<Distance> error;
if (s.length() != 4) return error;
Distance distance;
distance.distUnit = Unit::METERS;
if (s == "////") return distance;
const auto dist = strToUint(s, 0, 4);
if (!dist.has_value()) return error;
distance.dist = dist;
if (const auto valueMoreThan10km = 9999u; distance.dist == valueMoreThan10km) {
distance.distModifier = Modifier::MORE_THAN;
distance.dist = 10000u;
}
return distance;
}
std::optional<Distance> Distance::fromMileString(const std::string & s,
bool remarkFormat)
{
// static const std::regex rgx ("([PM])?(\\d?\\d)(?:/(\\d?\\d))?SM|////SM");
// static const std::regex rgx ("([PM])?(\\d?\\d)(?:/(\\d?\\d))?");
static const std::optional<Distance> error;
static const auto unitStr = std::string ("SM");
static const auto unitLength = unitStr.length();
Distance distance;
distance.distUnit = Unit::STATUTE_MILES;
if (!remarkFormat) {
if (s.length() < unitLength + 1) return error; //1 digit minimum
if (s == "////SM") return distance;
if (s.substr(s.length() - unitLength, unitLength) != unitStr) return error; //s.endsWith(unitStr)
} else {
if (s.length() < 1) return error; //1 digit minimum
}
const auto modifier = modifierFromChar(s[0]);
if (modifier.has_value()) {
distance.distModifier = *modifier;
}
if (s.find('/') == std::string::npos) {
//The value is integer, e.g. 3SM or 15SM
const int intPos = static_cast<int>(modifier.has_value());
const int intLength = s.length() -
(remarkFormat ? 0 : unitLength) -
static_cast<int>(modifier.has_value());
static const int minDigits = 1, maxDigits = 2;
if (intLength < minDigits || intLength > maxDigits) return error;
const auto dist = strToUint(s, intPos, intLength);
if (!dist.has_value()) return error;
distance.dist = *dist * statuteMileFactor;
} else {
//Fraction value, e.g. 1/2SM, 11/2SM, 5/16SM, 11/16SM
const int fracLength = s.length() -
(remarkFormat ? 0: unitLength) -
static_cast<int>(modifier.has_value());
const auto fraction = fractionStrToUint(s,
static_cast<int>(modifier.has_value()),
fracLength);
if (!fraction.has_value()) return error;
auto integer = 0u;
auto numerator = std::get<0>(*fraction);
auto denominator = std::get<1>(*fraction);
if (!numerator || !denominator) return error;
if (numerator >= denominator) { //e.g. 11/2SM = 1 1/2SM
static const auto decimalRadix = 10u;
integer = numerator / decimalRadix;
numerator = numerator % decimalRadix;
}
if (!numerator) return error;
distance.dist =
integer * statuteMileFactor +
numerator * statuteMileFactor / denominator;
}
return distance;
}
std::optional<Distance> Distance::fromHeightString(const std::string & s) {
//static const std::regex rgx ("(\\d\\d\\d)|///");
static const std::optional<Distance> error;
if (s.length() != 3) return error;
Distance distance;
distance.distUnit = Unit::FEET;
if (s == "///") return distance;
const auto h = strToUint(s, 0, 3);
if (!h.has_value()) return error;
distance.dist = *h * heightFactor;
return distance;
}
std::optional<Distance> Distance::fromRvrString(const std::string & s, bool unitFeet) {
//static const std::regex rgx ("([PM])?(\\d\\d\\d\\d)|////");
static const std::optional<Distance> error;
Distance distance;
distance.distUnit = unitFeet ? Unit::FEET : Unit::METERS;
if (s.length() == 4) {
if (s == "////") return distance;
const auto dist = strToUint(s, 0, 4);
if (!dist.has_value()) return error;
distance.dist = *dist;
return distance;
}
if (s.length() == 5) {
auto modifier = modifierFromChar(s[0]);
if (!modifier.has_value()) return error;
distance.distModifier = *modifier;
const auto dist = strToUint(s, 1, 4);
if (!dist.has_value()) return error;
distance.dist = *dist;
return distance;
}
return error;
}
std::optional<std::pair<Distance, Distance>> Distance::fromLayerString(
const std::string & s)
{
//static const std::regex rgx ("(\\d\\d\\d)(\\d)");
static const std::optional<std::pair<Distance, Distance>> error;
if (s.length() != 4) return error;
const auto h = strToUint(s, 0, 3);
if (!h.has_value()) return error;
const auto d = strToUint(s, 3, 1);
if (!d.has_value()) return error;
Distance baseHeight, topHeight;
baseHeight.distUnit = Unit::FEET;
topHeight.distUnit = Unit::FEET;
baseHeight.dist = *h * heightFactor;
topHeight.dist = *h * heightFactor + *d * layerDepthFactor;
return std::pair(baseHeight, topHeight);
}
std::optional<Distance> Distance::fromKmString(const std::string & s) {
//static const std::regex rgx ("(\\d\\d?)KM");
static const std::optional<Distance> error;
static const auto metersPerKm = 1000u;
if (s.length() != 3 && s.length() != 4) return error;
static const char kmStr[] = "KM";
static const size_t kmStrLen = std::strlen(kmStr);
const auto numLen = s.length() - kmStrLen;
if (s.substr(numLen) != kmStr) return error;
const auto dist = strToUint(s, 0, numLen);
if (!dist.has_value()) return error;
Distance distance;
distance.distUnit = Unit::METERS;
distance.dist = *dist * metersPerKm;
return distance;
}
std::optional<Distance> Distance::fromIntegerAndFraction(const Distance & integer,
const Distance & fraction)
{
static const std::optional<Distance> error;
if (integer.modifier() != Modifier::NONE &&
integer.modifier() != Modifier::LESS_THAN &&
integer.modifier() != Modifier::MORE_THAN) return error;
if (!integer.isValid() ||
!fraction.isValid() ||
fraction.modifier() != Modifier::NONE ||
integer.unit() != Unit::STATUTE_MILES ||
fraction.unit() != Unit::STATUTE_MILES ||
!integer.dist.has_value() ||
!fraction.dist.has_value() ||
(*integer.dist % statuteMileFactor) ||
!(*fraction.dist % statuteMileFactor)) return error;
Distance result;
result.distModifier = integer.modifier();
result.dist = *integer.dist + *fraction.dist;
result.distUnit = Unit::STATUTE_MILES;
return result;
}
std::optional<float> Distance::toUnit(Unit unit) const {
const auto d = distance();
if (!d.has_value()) return std::optional<float>();
switch (distUnit) {
case Unit::METERS: return metersToUnit(*d, unit);
case Unit::STATUTE_MILES: return milesToUnit(*d, unit);
case Unit::FEET: return feetToUnit(*d, unit);
}
}
std::optional<float> Distance::distance() const {
if (!dist.has_value()) return std::optional<float>();
if (distUnit == Unit::STATUTE_MILES)
return (static_cast<float>(*dist) / statuteMileFactor);
return *dist;
}
std::optional<std::pair<unsigned int, Distance::MilesFraction>> Distance::miles() const
{
const auto milesDecimal = toUnit(Unit::STATUTE_MILES);
if (!milesDecimal.has_value()) return std::optional<std::pair<unsigned int, Distance::MilesFraction>>();
static const unsigned int denominator = 16u;
const unsigned int topHeavyNumerator = std::round(*milesDecimal * denominator);
switch (topHeavyNumerator) {
case 0: return std::pair(0u, MilesFraction::NONE);
case 1: return std::pair(0u, MilesFraction::F_1_16);
case 2: return std::pair(0u, MilesFraction::F_1_8);
case 3: return std::pair(0u, MilesFraction::F_3_16);
case 4: return std::pair(0u, MilesFraction::F_1_4);
case 5: return std::pair(0u, MilesFraction::F_5_16);
case 6:
case 7: return std::pair(0u, MilesFraction::F_3_8);
case 8:
case 9: return std::pair(0u, MilesFraction::F_1_2);
case 10:
case 11: return std::pair(0u, MilesFraction::F_5_8);
case 12:
case 13: return std::pair(0u, MilesFraction::F_3_4);
case 14:
case 15: return std::pair(0u, MilesFraction::F_7_8);
case 16:
case 17: return std::pair(1u, MilesFraction::NONE);
case 18:
case 19: return std::pair(1u, MilesFraction::F_1_8);
case 20:
case 21: return std::pair(1u, MilesFraction::F_1_4);
case 22:
case 23: return std::pair(1u, MilesFraction::F_3_8);
case 24:
case 25: return std::pair(1u, MilesFraction::F_1_2);
case 26:
case 27: return std::pair(1u, MilesFraction::F_5_8);
case 28:
case 29: return std::pair(1u, MilesFraction::F_3_4);
case 30:
case 31: return std::pair(1u, MilesFraction::F_7_8);
case 32:
case 33:
case 34:
case 35: return std::pair(2u, MilesFraction::NONE);
case 36:
case 37:
case 38:
case 39: return std::pair(2u, MilesFraction::F_1_4);
case 40:
case 41:
case 42:
case 43: return std::pair(2u, MilesFraction::F_1_2);
case 44:
case 45:
case 46:
case 47: return std::pair(2u, MilesFraction::F_3_4);
default: break;
}
unsigned int integer = topHeavyNumerator / denominator;
if (integer > 15) integer = 5 * (integer / 5);
return std::pair (integer, MilesFraction::NONE);
}
std::optional<Distance::Modifier> Distance::modifierFromChar(char c) {
if (c == 'M') return Modifier::LESS_THAN;
if (c == 'P') return Modifier::MORE_THAN;
return std::optional<Modifier>();
}
std::optional<float> Distance::metersToUnit(float value, Unit unit) {
switch(unit) {
case Unit::METERS: return value;
case Unit::STATUTE_MILES: return (value / 1609.347);
case Unit::FEET: return (value / 0.3048);
}
}
std::optional<float> Distance::milesToUnit(float value, Unit unit) {
switch(unit) {
case Unit::METERS: return (value * 1609.347);
case Unit::STATUTE_MILES: return value;
case Unit::FEET: return (value * 5280.0);
}
}
std::optional<float> Distance::feetToUnit(float value, Unit unit) {
switch(unit) {
case Unit::METERS: return (value * 0.3048);
case Unit::STATUTE_MILES: return (value / 5280.0);
case Unit::FEET: return value;
}
}
Distance Distance::cavokVisibility(bool unitMiles) {
Distance result;
result.distModifier = Modifier::MORE_THAN;
result.dist = cavokVisibilityMeters;
result.distUnit = Unit::METERS;
if (unitMiles) {
result.dist = cavokVisibilityMiles * statuteMileFactor;
result.distUnit = Unit::STATUTE_MILES;
}
return result;
}
Distance Distance::makeDistant() {
Distance result;
result.distModifier = Modifier::DISTANT;
return result;
}
Distance Distance::makeVicinity() {
Distance result;
result.distModifier = Modifier::VICINITY;
return result;
}
////////////////////////////////////////////////////////////////////////////////
std::optional<Direction> Direction::fromCardinalString(
const std::string & s,
bool enableOhdAlqds,
bool enableUnknown)
{
std::optional<Direction> error;
if (s.empty()) return error;
if (s == "NDV") {
Direction dir;
dir.dirType = Type::NDV;
return dir;
}
if (enableOhdAlqds && s == "OHD") {
Direction dir;
dir.dirType = Type::OVERHEAD;
return dir;
}
if (enableOhdAlqds && s == "ALQDS") {
Direction dir;
dir.dirType = Type::ALQDS;
return dir;
}
if (enableUnknown && s == "UNKNOWN") {
Direction dir;
dir.dirType = Type::UNKNOWN;
return dir;
}
int cardinalDegrees = 0;
if (s == "N") cardinalDegrees = degreesTrueNorth;
if (s == "W") cardinalDegrees = degreesTrueWest;
if (s == "S") cardinalDegrees = degreesTrueSouth;
if (s == "E") cardinalDegrees = degreesTrueEast;
if (s == "NW") cardinalDegrees = degreesNorthWest;
if (s == "NE") cardinalDegrees = degreesNorthEast;
if (s == "SW") cardinalDegrees = degreesSouthWest;
if (s == "SE") cardinalDegrees = degreesSouthEast;
if (!cardinalDegrees) return error;
Direction dir;
dir.dirType = Type::VALUE_CARDINAL;
dir.dirDegrees = cardinalDegrees;
return dir;
}
std::optional<Direction> Direction::fromDegreesString(const std::string & s) {
std::optional<Direction> error;
Direction direction;
if (s.length() != 3) return error;
if (s == "///") {
direction.dirType = Type::NOT_REPORTED;
return direction;
}
if (s == "VRB") {
direction.dirType = Type::VARIABLE;
return direction;
}
//static const std::regex rgx("\\d\\d0");
if (s[2] != '0') return error;
const auto dir = strToUint(s, 0, 3);
if (!dir.has_value()) return error;
direction.dirType = Type::VALUE_DEGREES;
direction.dirDegrees = *dir;
return direction;
}
Direction::Cardinal Direction::cardinal(bool trueDirections) const {
switch (type()) {
case Type::NOT_REPORTED: return Cardinal::NOT_REPORTED;
case Type::VARIABLE: return Cardinal::VRB;
case Type::NDV: return Cardinal::NDV;
case Type::OVERHEAD: return Cardinal::OHD;
case Type::ALQDS: return Cardinal::ALQDS;
case Type::UNKNOWN: return Cardinal::UNKNOWN;
case Type::VALUE_DEGREES: break;
case Type::VALUE_CARDINAL: break;
}
if (trueDirections) {
if (dirDegrees == degreesTrueNorth) return Cardinal::TRUE_N;
if (dirDegrees == degreesTrueSouth) return Cardinal::TRUE_S;
if (dirDegrees == degreesTrueWest) return Cardinal::TRUE_W;
if (dirDegrees == degreesTrueEast) return Cardinal::TRUE_E;
}
//Degree values specifying cardinal direction sectors must be sorted.
if (dirDegrees <= octantSize/2) return Cardinal::N;
if (dirDegrees <= (degreesNorthEast + octantSize/2)) return Cardinal::NE;
if (dirDegrees <= (degreesTrueEast + octantSize/2)) return Cardinal::E;
if (dirDegrees <= (degreesSouthEast + octantSize/2)) return Cardinal::SE;
if (dirDegrees <= (degreesTrueSouth + octantSize/2)) return Cardinal::S;
if (dirDegrees <= (degreesSouthWest + octantSize/2)) return Cardinal::SW;
if (dirDegrees <= (degreesTrueWest + octantSize/2)) return Cardinal::W;
if (dirDegrees <= (degreesNorthWest + octantSize/2)) return Cardinal::NW;
if (dirDegrees <= maxDegrees) return Cardinal::N;
return Cardinal::NOT_REPORTED;
}
std::optional<std::pair<Direction, Direction>> Direction::fromSectorString(
const std::string & s)
{
static const std::optional<std::pair<Direction, Direction>> notRecognised;
static const std::regex rgx
("([NSWE][WE]?)(?:-[NSWE]|-[NS][WE])*-([NSWE][WE]?)");
static const auto matchBegin = 1, matchEnd = 2;
std::smatch match;
if (!regex_match(s, match, rgx)) return notRecognised;
const auto dirBegin = fromCardinalString(match.str(matchBegin));
if (!dirBegin.has_value()) return(notRecognised);
const auto dirEnd = fromCardinalString(match.str(matchEnd));
if (!dirEnd.has_value()) return(notRecognised);
return std::pair(*dirBegin, *dirEnd);
}
std::vector<Direction> Direction::sectorCardinalDirToVector(
const Direction & dirFrom,
const Direction & dirTo)
{
std::vector<Direction> result;
const auto cardinalFrom = dirFrom.cardinal();
const auto cardinalTo = dirTo.cardinal();
if (cardinalFrom == Cardinal::NOT_REPORTED ||
cardinalFrom == Cardinal::VRB ||
cardinalFrom == Cardinal::NDV ||
cardinalFrom == Cardinal::OHD ||
cardinalFrom == Cardinal::ALQDS ||
cardinalTo == Cardinal::NOT_REPORTED ||
cardinalTo == Cardinal::VRB ||
cardinalTo == Cardinal::NDV ||
cardinalTo == Cardinal::OHD ||
cardinalTo == Cardinal::ALQDS)
{
// Not a valid direction sector, one or both begin and end directions are
// not cardinal directions
if (cardinalFrom != Cardinal::NOT_REPORTED) result.push_back(cardinalFrom);
if (cardinalTo != Cardinal::NOT_REPORTED) result.push_back(cardinalTo);
return result;
}
// Both sector begin and end are cardinal directions
auto cardinalCurr = cardinalFrom;
while (cardinalCurr != cardinalTo)
{
result.push_back(cardinalCurr);
cardinalCurr = rotateOctantClockwise(cardinalCurr);
}
result.push_back(cardinalTo);
return result;
}
Direction::Cardinal Direction::rotateOctantClockwise(Cardinal cardinal) {
switch(cardinal) {
case Cardinal::TRUE_N: return Cardinal::NE;
case Cardinal::TRUE_E: return Cardinal::SE;
case Cardinal::TRUE_S: return Cardinal::SW;
case Cardinal::TRUE_W: return Cardinal::NW;
case Cardinal::N: return Cardinal::NE;
case Cardinal::NE: return Cardinal::E;
case Cardinal::E: return Cardinal::SE;
case Cardinal::SE: return Cardinal::S;
case Cardinal::S: return Cardinal::SW;
case Cardinal::SW: return Cardinal::W;
case Cardinal::W: return Cardinal::NW;
case Cardinal::NW: return Cardinal::N;
default: return Cardinal::NOT_REPORTED;
}
}
Direction::Direction(Cardinal c) {
dirType = Type::VALUE_CARDINAL;
switch (c) {
case Cardinal::NOT_REPORTED: dirType = Type::NOT_REPORTED; break;
case Cardinal::VRB: dirType = Type::VARIABLE; break;
case Cardinal::NDV: dirType = Type::NDV; break;
case Cardinal::N: dirDegrees = degreesTrueNorth; break;
case Cardinal::S: dirDegrees = degreesTrueSouth; break;
case Cardinal::W: dirDegrees = degreesTrueWest; break;
case Cardinal::E: dirDegrees = degreesTrueEast; break;
case Cardinal::NW: dirDegrees = degreesNorthWest; break;
case Cardinal::NE: dirDegrees = degreesNorthEast; break;
case Cardinal::SW: dirDegrees = degreesSouthWest; break;
case Cardinal::SE: dirDegrees = degreesSouthEast; break;
case Cardinal::TRUE_N: dirDegrees = degreesTrueNorth; break;
case Cardinal::TRUE_W: dirDegrees = degreesTrueSouth; break;
case Cardinal::TRUE_S: dirDegrees = degreesTrueWest; break;
case Cardinal::TRUE_E: dirDegrees = degreesTrueEast; break;
case Cardinal::OHD: dirType = Type::OVERHEAD; break;
case Cardinal::ALQDS: dirType = Type::ALQDS; break;
case Cardinal::UNKNOWN: dirType = Type::UNKNOWN; break;
}
}
///////////////////////////////////////////////////////////////////////////////
std::optional<Pressure> Pressure::fromString(const std::string & s) {
//static const std::regex rgx("([QA])(?:(\\d\\d\\d\\d)|////)");
static const std::optional<Pressure> error;
if (s.length() != 5) return error;
Pressure pressure;
if (s == "A////") {
pressure.pressureUnit = Unit::INCHES_HG;
return pressure;
}
if (s == "Q////") {
pressure.pressureUnit = Unit::HECTOPASCAL;
return pressure;
}
const auto pr = strToUint(s, 1, 4);
if (!pr.has_value()) return error;
switch (s[0]) {
case 'A':
pressure.pressureUnit = Unit::INCHES_HG;
pressure.pressureValue = *pr * inHgDecimalPointShift;
break;
case 'Q':
pressure.pressureUnit = Unit::HECTOPASCAL;
pressure.pressureValue = *pr;
break;
default: return error;
}
return pressure;
}
std::optional<Pressure> Pressure::fromForecastString(const std::string & s) {
//static const std::regex rgx("QNH(\\d\\d\\d\\d)INS");
static const std::optional<Pressure> error;
if (s.length() != 10) return error;
if (s[0] != 'Q' || s[1] != 'N' || s[2] != 'H') return error;
if (s[7] != 'I' || s[8] != 'N' || s[9] != 'S') return error;
const auto pr = strToUint(s, 3, 4);
if (!pr.has_value()) return error;
Pressure pressure;
pressure.pressureUnit = Unit::INCHES_HG;
pressure.pressureValue = *pr * inHgDecimalPointShift;
return pressure;
}
std::optional<Pressure> Pressure::fromSlpString(const std::string & s) {
//SLP982 = 998.2 hPa, SLP015 = 1001.5 hPa, SLP221 = 1022.1 hPa
//static const std::regex rgx("SLP(\\d\\d\\d)");
static const std::optional<Pressure> error;
if (s.length() != 6) return error;
if (s[0] != 'S' || s[1] != 'L' || s[2] != 'P') return error;
const auto pr = strToUint(s, 3, 3);
if (!pr.has_value()) return error;
static const auto slpDecimalPointShift = 0.1;
const auto base = (*pr < 500) ? 1000 : 900;
Pressure pressure;
pressure.pressureUnit = Unit::HECTOPASCAL;
pressure.pressureValue = *pr * slpDecimalPointShift + base;
return pressure;
}
std::optional<Pressure> Pressure::fromQfeString(const std::string & s) {
//static const std::regex rgx("QFE(\\d\\d\\d)(/\\d\\d\\d\\d)?");
static const std::optional<Pressure> error;
if (s.length() != 6 && s.length() != 11) return error;
if (s[0] != 'Q' || s[1] != 'F' || s[2] != 'E') return error;
const auto mmHg = strToUint(s, 3, 3);
if (!mmHg.has_value()) return error;
if (s.length() == 11) {
const auto hPa = strToUint(s, 7, 4);
if (!hPa.has_value() || s[6] != '/') return error;
//Value in hPa is ignored (parsed only for group syntax check)
}
Pressure pressure;
pressure.pressureUnit = Unit::MM_HG;
pressure.pressureValue = *mmHg;
return pressure;
}
std::optional<Pressure> Pressure::fromTendencyString(const std::string & s) {
//static const std::regex rgx("(\\d\\d\\d)|///");
static const std::optional<Pressure> error;
if (s.length() != 3) return error;
if (s == "///") return Pressure();
const auto hPa = strToUint(s, 0, 3);
if (!hPa.has_value()) return error;
Pressure pressure;
pressure.pressureUnit = Unit::HECTOPASCAL;
pressure.pressureValue = *hPa * tendencyDecimalPointShift;
return pressure;
}
std::optional<float> Pressure::toUnit(Unit unit) const {
if (!pressureValue.has_value()) return std::optional<float>();
auto v = *pressureValue;
static const auto hpaPerInHg = 33.8639;
static const auto hpaPerMmHg = 1.3332;
static const auto mmPerInch = 25.4;
switch (pressureUnit) {
case Unit::HECTOPASCAL:
switch (unit) {
case Unit::HECTOPASCAL: return v;
case Unit::INCHES_HG: return (v / hpaPerInHg);
case Unit::MM_HG: return (v / hpaPerMmHg);
}
case Unit::INCHES_HG:
switch (unit) {
case Unit::HECTOPASCAL: return (v * hpaPerInHg);
case Unit::INCHES_HG: return v;
case Unit::MM_HG: return (v * mmPerInch);
}
case Unit::MM_HG:
switch (unit) {
case Unit::HECTOPASCAL: return (v * hpaPerMmHg);
case Unit::INCHES_HG: return (v / mmPerInch);
case Unit::MM_HG: return v;
}
}
}
///////////////////////////////////////////////////////////////////////////////
std::optional<Precipitation> Precipitation::fromRainfallString(const std::string & s) {
//static const std::regex rgx("\\d?\\d\\d\\.\\d");
static const std::optional<Precipitation> error;
if (s == "///./" || s == "//./") return Precipitation();
if (s.length() != 4 && s.length() != 5) return error;
if (s[s.length()-2] != '.') return error;
const auto fractPart = strToUint(s, s.length() - 1, 1);
if (!fractPart.has_value()) return error;
const auto intPart = strToUint(s, 0, s.length() - 2);
if (!intPart.has_value()) return error;
Precipitation precipitation;
precipitation.precipValue = *intPart + 0.1 * *fractPart;
return precipitation;
}
std::optional<Precipitation> Precipitation::fromRunwayDeposits(const std::string & s) {
//static const std::regex rgx("\\d\\d");
std::optional<Precipitation> error;
if (s.length() != 2) return error;
if (s == "//") return Precipitation();
const auto depth = strToUint(s, 0, 2);
if (!depth.has_value()) return error;
Precipitation precipitation;
switch (*depth) {
case Reserved::RESERVED: return error;
case Reserved::DEPTH_10CM: precipitation.precipValue = 100; break;
case Reserved::DEPTH_15CM: precipitation.precipValue = 150; break;
case Reserved::DEPTH_20CM: precipitation.precipValue = 200; break;
case Reserved::DEPTH_25CM: precipitation.precipValue = 250; break;
case Reserved::DEPTH_30CM: precipitation.precipValue = 300; break;
case Reserved::DEPTH_35CM: precipitation.precipValue = 350; break;
case Reserved::DEPTH_40CM: precipitation.precipValue = 400; break;
case Reserved::RUNWAY_NOT_OPERATIONAL:
precipitation.precipValue = std::optional<float>();
break;
default:
precipitation.precipValue = *depth;
break;
}
return precipitation;
}
std::optional<Precipitation> Precipitation::fromRemarkString(const std::string & s,
float factor,
Precipitation::Unit unit,
bool allowNotReported)
{
//static const std::regex rgx("\\d\\d\\d\\d?");
std::optional<Precipitation> error;
Precipitation precipitation;
precipitation.precipUnit = unit;
if (s.length() != 3 && s.length() != 4) return error;
if (s == "///" || s == "////") {
if (!allowNotReported) return error;
return precipitation;
}
const auto pr = strToUint(s, 0, s.length());
if (!pr.has_value()) return error;
precipitation.precipValue = *pr * factor;
return precipitation;
}
std::optional<std::pair<Precipitation, Precipitation>>
Precipitation::fromSnincrString(const std::string & s)
{
//static const std::regex rgx("\\d?\\d)/(\\d?\\d");
static const std::optional<std::pair<Precipitation, Precipitation>> error;
const auto fraction = fractionStrToUint(s, 0, s.length());
if (!fraction.has_value()) return error;
Precipitation total;
total.precipUnit = Precipitation::Unit::INCHES;
total.precipValue = std::get<0>(*fraction);
Precipitation change;
change.precipUnit = Precipitation::Unit::INCHES;
change.precipValue = std::get<1>(*fraction);
return std::pair(total, change);
}
std::optional<float> Precipitation::toUnit(Unit unit) const {
if (precipValue.has_value()) {
if (precipUnit == unit) return precipValue;
static const auto mmPerInch = 25.4;
if (precipUnit == Unit::MM && unit == Unit::INCHES) {
return (*precipValue / mmPerInch);
}
if (precipUnit == Unit::INCHES && unit == Unit::MM) {
return (*precipValue * mmPerInch);
}
}
return std::optional<float>();
}
///////////////////////////////////////////////////////////////////////////////
std::optional<SurfaceFriction> SurfaceFriction::fromString(const std::string & s) {
//static const std::regex rgx("\\d\\d");
static const std::optional<SurfaceFriction> error;
if (s.length() != 2) return error;
if (s == "//") return SurfaceFriction();
const auto sfVal = strToUint(s, 0, 2);
if (!sfVal.has_value()) return error;
SurfaceFriction sf;
auto coefficient = *sfVal;
switch (coefficient) {
case Reserved::BRAKING_ACTION_POOR:
sf.sfType = Type::BRAKING_ACTION_REPORTED;
sf.sfCoefficient = baPoorLowLimit;
break;
case Reserved::BRAKING_ACTION_MEDIUM_POOR:
sf.sfType = Type::BRAKING_ACTION_REPORTED;
sf.sfCoefficient = baMediumPoorLowLimit;
break;
case Reserved::BRAKING_ACTION_MEDIUM:
sf.sfType = Type::BRAKING_ACTION_REPORTED;
sf.sfCoefficient = baMediumLowLimit;
break;
case Reserved::BRAKING_ACTION_MEDIUM_GOOD:
sf.sfType = Type::BRAKING_ACTION_REPORTED;
sf.sfCoefficient = baMediumGoodLowLimit;
break;
case Reserved::BRAKING_ACTION_GOOD:
sf.sfType = Type::BRAKING_ACTION_REPORTED;
sf.sfCoefficient = baGoodLowLimit;
break;
case Reserved::RESERVED_96:
case Reserved::RESERVED_97:
case Reserved::RESERVED_98:
return std::optional<SurfaceFriction>();
case Reserved::UNRELIABLE:
sf.sfType = Type::UNRELIABLE;
break;
default:
sf.sfCoefficient = coefficient;
sf.sfType = Type::SURFACE_FRICTION_REPORTED;
break;
}
return sf;
}
SurfaceFriction::BrakingAction SurfaceFriction::brakingAction() const {
if (sfType == Type::NOT_REPORTED ||
sfType == Type::UNRELIABLE) return BrakingAction::NONE;
if (sfCoefficient < baMediumPoorLowLimit) return BrakingAction::POOR;
if (sfCoefficient < baMediumLowLimit) return BrakingAction::MEDIUM_POOR;
if (sfCoefficient < baMediumGoodLowLimit) return BrakingAction::MEDIUM;
if (sfCoefficient < baGoodLowLimit) return BrakingAction::MEDIUM_GOOD;
return BrakingAction::GOOD;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<WaveHeight> WaveHeight::fromString(const std::string & s) {
//static const std::regex rgx("S(\\d)|H(\\d?\\d?\\d)");
static const std::optional<WaveHeight> error;
if (s.length() < 2 || s.length() > 4) return error;
WaveHeight wh;
if (s == "H///") {
wh.whType = Type::WAVE_HEIGHT;
return wh;
}
if (s == "S/") {
wh.whType = Type::STATE_OF_SURFACE;
return wh;
}
if (s[0] == 'S') {
if (s.length() != 2) return error;
auto h = waveHeightFromStateOfSurfaceChar(s[1]);
if (!h.has_value()) return error;
wh.whType = Type::STATE_OF_SURFACE;
wh.whValue = *h;
return wh;
}
if (s[0] == 'H') {
auto h = strToUint(s, 1, s.length() - 1);
if (!h.has_value()) return error;
wh.whType = Type::WAVE_HEIGHT;
wh.whValue = *h;
return wh;
}
return error;
}
std::optional<float> WaveHeight::toUnit(Unit unit) const {
const auto wh = waveHeight();
if (!wh.has_value() || whUnit != Unit::METERS) return std::optional<float>();
switch (unit) {
case Unit::METERS: return *wh;
case Unit::FEET: return *wh / 0.3048;
}
}
WaveHeight::StateOfSurface WaveHeight::stateOfSurface() const {
if (!whValue.has_value()) return StateOfSurface::NOT_REPORTED;
const auto h = *whValue;
// Wave heights must be sorted
if (!h) return StateOfSurface::CALM_GLASSY;
if (h <= maxWaveHeightCalmRippled) return StateOfSurface::CALM_RIPPLED;
if (h <= maxWaveHeightSmooth) return StateOfSurface::SMOOTH;
if (h <= maxWaveHeightSlight) return StateOfSurface::SLIGHT;
if (h <= maxWaveHeightModerate) return StateOfSurface::MODERATE;
if (h <= maxWaveHeightRough) return StateOfSurface::ROUGH;
if (h <= maxWaveHeightVeryRough) return StateOfSurface::VERY_ROUGH;
if (h <= maxWaveHeightHigh) return StateOfSurface::HIGH;
if (h <= maxWaveHeightVeryHigh) return StateOfSurface::VERY_HIGH;
return StateOfSurface::PHENOMENAL;
}
std::optional<unsigned int> WaveHeight::waveHeightFromStateOfSurfaceChar(char c) {
switch (c) {
case '0': return maxWaveHeightCalmGlassy;
case '1': return maxWaveHeightCalmRippled;
case '2': return maxWaveHeightSmooth;
case '3': return maxWaveHeightSlight;
case '4': return maxWaveHeightModerate;
case '5': return maxWaveHeightRough;
case '6': return maxWaveHeightVeryRough;
case '7': return maxWaveHeightHigh;
case '8': return maxWaveHeightVeryHigh;
case '9': return minWaveHeightPhenomenal;
default: return std::optional<unsigned int>();
}
}
///////////////////////////////////////////////////////////////////////////////
WeatherPhenomena::Qualifier WeatherPhenomena::qualifier() const
{
return static_cast<Qualifier>((data >> qualifierShiftBits) & qualifierMask);
}
WeatherPhenomena::Descriptor WeatherPhenomena::descriptor() const
{
return static_cast<Descriptor>((data >> descriptorShiftBits) & descriptorMask);
}
std::vector<WeatherPhenomena::Weather> WeatherPhenomena::weather() const
{
std::vector<Weather> result;
const uint32_t sz = (data >> weatherCountShiftBits) & weatherCountMask;
if (sz > 0) {
const Weather w =
static_cast<Weather>((data >> weather0ShiftBits) & weatherMask);
result.push_back(w);
}
if (sz > 1) {
const Weather w =
static_cast<Weather>((data >> weather1ShiftBits) & weatherMask);
result.push_back(w);
}
if (sz > 2) {
const Weather w =
static_cast<Weather>((data >> weather2ShiftBits) & weatherMask);
result.push_back(w);
}
return result;
}
WeatherPhenomena::Event WeatherPhenomena::event() const {
return static_cast<Event>((data >> eventShiftBits) & eventMask);
}
std::optional <WeatherPhenomena> WeatherPhenomena::fromString(const std::string & s,
bool enableQualifiers)
{
// Descriptors MI, PR, BC are allowed only with FG
if (s == "MIFG") return WeatherPhenomena(Weather::FOG, Descriptor::SHALLOW);
if (s == "PRFG") return WeatherPhenomena(Weather::FOG, Descriptor::PARTIAL);
if (s == "BCFG") return WeatherPhenomena(Weather::FOG, Descriptor::PATCHES);
// Descriptor DR is allowed only with DU SA SN
if (s == "DRDU") return WeatherPhenomena(Weather::DUST, Descriptor::LOW_DRIFTING);
if (s == "DRSA") return WeatherPhenomena(Weather::SAND, Descriptor::LOW_DRIFTING);
if (s == "DRSN") return WeatherPhenomena(Weather::SNOW, Descriptor::LOW_DRIFTING);
// Descriptor BL is allowed only with DU SA SN PY
if (s == "BLDU") return WeatherPhenomena(Weather::DUST, Descriptor::BLOWING);
if (s == "BLSA") return WeatherPhenomena(Weather::SAND, Descriptor::BLOWING);
if (s == "BLSN") return WeatherPhenomena(Weather::SNOW, Descriptor::BLOWING);
if (s == "BLPY") return WeatherPhenomena(Weather::SPRAY, Descriptor::BLOWING);
// Descriptor TS is allowed alone (or with precipitation)
if (s == "TS") return WeatherPhenomena(Descriptor::THUNDERSTORM);
// Descriptor FZ is allowed only with FG (or with precipitation)
if (s == "FZFG") return WeatherPhenomena(Weather::FOG, Descriptor::FREEZING);
// Phenomena IC BR FG FU VA DU SA HZ PO SQ FC are allowed only when alone
// in the group, with no other phenomena present
if (s == "IC") return WeatherPhenomena(Weather::ICE_CRYSTALS);
if (s == "BR") return WeatherPhenomena(Weather::MIST);
if (s == "FG") return WeatherPhenomena(Weather::FOG);
if (s == "FU") return WeatherPhenomena(Weather::SMOKE);
if (s == "VA") return WeatherPhenomena(Weather::VOLCANIC_ASH);
if (s == "DU") return WeatherPhenomena(Weather::DUST);
if (s == "SA") return WeatherPhenomena(Weather::SAND);
if (s == "HZ") return WeatherPhenomena(Weather::HAZE);
if (s == "PO") return WeatherPhenomena(Weather::DUST_WHIRLS);
if (s == "SQ") return WeatherPhenomena(Weather::SQUALLS);
if (s == "FC") return WeatherPhenomena(Weather::FUNNEL_CLOUD);
// Phenomena SS DS are only allowed alone or in combination with each other
if (s == "DS") return WeatherPhenomena(Weather::DUSTSTORM);
if (s == "SS") return WeatherPhenomena(Weather::SANDSTORM);
if (s == "DSSS") return WeatherPhenomena(Weather::DUSTSTORM, Weather::SANDSTORM);
if (s == "SSDS") return WeatherPhenomena(Weather::SANDSTORM, Weather::DUSTSTORM);
if (enableQualifiers) {
// Qualifier VC is allowed only with VCTS VCFG VCSH VCPO VCFC VCVA VCBLDU
// VCBLSA VCBLSN VCDS VCSS
if (s == "VCTS")
return WeatherPhenomena(Descriptor::THUNDERSTORM, Qualifier::VICINITY);
if (s == "VCFG")
return WeatherPhenomena(Weather::FOG, Descriptor::NONE, Qualifier::VICINITY);
if (s == "VCSH")
return WeatherPhenomena(Descriptor::SHOWERS, Qualifier::VICINITY);
if (s == "VCPO")
return WeatherPhenomena(Weather::DUST_WHIRLS, Descriptor::NONE, Qualifier::VICINITY);
if (s == "VCVA")
return WeatherPhenomena(Weather::VOLCANIC_ASH, Descriptor::NONE, Qualifier::VICINITY);
if (s == "VCFC")
return WeatherPhenomena(Weather::FUNNEL_CLOUD, Descriptor::NONE, Qualifier::VICINITY);
if (s == "VCBLDU")
return WeatherPhenomena(Weather::DUST, Descriptor::BLOWING, Qualifier::VICINITY);
if (s == "VCBLSA")
return WeatherPhenomena(Weather::SAND, Descriptor::BLOWING, Qualifier::VICINITY);
if (s == "VCBLSN")
return WeatherPhenomena(Weather::SNOW, Descriptor::BLOWING, Qualifier::VICINITY);
if (s == "VCDS")
return WeatherPhenomena(Weather::DUSTSTORM, Descriptor::NONE, Qualifier::VICINITY);
if (s == "VCSS")
return WeatherPhenomena(Weather::SANDSTORM, Descriptor::NONE, Qualifier::VICINITY);
// Qualifier + are allowed with FC DS SS (or with precipitation)
if (s == "+FC")
return WeatherPhenomena(Weather::FUNNEL_CLOUD, Descriptor::NONE, Qualifier::HEAVY);
if (s == "+DS")
return WeatherPhenomena(Weather::DUSTSTORM, Descriptor::NONE, Qualifier::HEAVY);
if (s == "+SS")
return WeatherPhenomena(Weather::SANDSTORM, Descriptor::NONE, Qualifier::HEAVY);
if (s == "+DSSS")
return WeatherPhenomena(Weather::DUSTSTORM, Weather::SANDSTORM,
Descriptor::NONE, Qualifier::HEAVY);
if (s == "+SSDS")
return WeatherPhenomena(Weather::SANDSTORM, Weather::DUSTSTORM,
Descriptor::NONE, Qualifier::HEAVY);
// Qualifier RE is allowed with TS descriptor without any phenomena
if (s == "RETS")
return WeatherPhenomena(Descriptor::THUNDERSTORM, Qualifier::RECENT);
}
// Precipitation
Qualifier resultQualifier = Qualifier::NONE;
Descriptor resultDescriptor = Descriptor::NONE;
std::vector<Weather> resultWeather;
std::string precipStr = s;
static const std::optional <WeatherPhenomena> error;
if (precipStr.length() < 2) return(error);
// Only + - RE qualifiers are allowed; no qualifier equals moderate intensity
if (enableQualifiers) {
resultQualifier = Qualifier::MODERATE;
switch (precipStr[0]) {
case '+':
resultQualifier = Qualifier::HEAVY;
precipStr = precipStr.substr(1);
break;
case '-':
resultQualifier = Qualifier::LIGHT;
precipStr = precipStr.substr(1);
break;
case 'R': // qualifier "RE"
if (precipStr[1] == 'E') {
resultQualifier = Qualifier::RECENT;
precipStr = precipStr.substr(2);
}
break;
default:
break;
}
}
// Descriptors SH TS and FZ are allowed
if (precipStr.length() < 2) return(error);
if (precipStr.substr(0, 2) == "SH") resultDescriptor = Descriptor::SHOWERS;
if (precipStr.substr(0, 2) == "TS") resultDescriptor = Descriptor::THUNDERSTORM;
if (precipStr.substr(0, 2) == "FZ") resultDescriptor = Descriptor::FREEZING;
if (resultDescriptor != Descriptor::NONE) precipStr = precipStr.substr(2);
// Phenomena DZ RA SN SG PL GR GS UP are allowed in any combinations if no
// duplicate phenomena is specified
// Descriptors without weather phenomena are not allowed at this point
// Descriptors SH TS are allowed only if at least one of the following #
// phenomena is present RA SN PL GR GS UP
// Descriptor FZ is allowed only if at least one of the following phenomena
// is present DZ RA UP
if (precipStr.length() < 2 || precipStr.length() % 2) return(error);
bool allowShDecriptor = false;
bool allowFzDecriptor = false;
for (auto i = 0u; i < wSize; i++) {
if (precipStr.empty()) break;
const auto ws = precipStr.substr(0,2);
std::optional<Weather> w;
if (ws == "DZ") w = Weather::DRIZZLE;
if (ws == "RA") w = Weather::RAIN;
if (ws == "SN") w = Weather::SNOW;
if (ws == "SG") w = Weather::SNOW_GRAINS;
if (ws == "PL") w = Weather::ICE_PELLETS;
if (ws == "GR") w = Weather::HAIL;
if (ws == "GS") w = Weather::SMALL_HAIL;
if (ws == "UP") w = Weather::UNDETERMINED;
if (!w.has_value()) return error;
if (isDescriptorShAllowed(*w)) allowShDecriptor = true;
if (isDescriptorFzAllowed(*w)) allowFzDecriptor = true;
for (auto j = 0u; j < resultWeather.size(); j++)
if (resultWeather[j] == *w) return error;
resultWeather.push_back(*w);
precipStr = precipStr.substr(2);
}
if (!precipStr.empty()) return error;
if (!allowShDecriptor && resultDescriptor == Descriptor::SHOWERS) return error;
if (!allowFzDecriptor && resultDescriptor == Descriptor::FREEZING) return error;
WeatherPhenomena result;
result.data = pack(resultQualifier, resultDescriptor, resultWeather);
return result;
}
inline bool WeatherPhenomena::isDescriptorShAllowed (Weather w) {
switch (w) {
case Weather::RAIN:
case Weather::SNOW:
case Weather::ICE_PELLETS:
case Weather::HAIL:
case Weather::SMALL_HAIL:
case Weather::UNDETERMINED:
return true;
default:
return false;
}
}
inline bool WeatherPhenomena::isDescriptorFzAllowed (Weather w) {
switch (w) {
case Weather::DRIZZLE:
case Weather::RAIN:
case Weather::UNDETERMINED:
return true;
default:
return false;
}
}
inline uint32_t WeatherPhenomena::pack(Qualifier q,
Descriptor d,
size_t wNum,
Weather w1,
Weather w2,
Weather w3,
Event e)
{
if (wNum > 3) wNum = 3;
uint32_t result = 0;
result |= (static_cast<uint32_t>(q) << qualifierShiftBits);
result |= (static_cast<uint32_t>(d) << descriptorShiftBits);
result |= (static_cast<uint32_t>(wNum) << weatherCountShiftBits);
result |= (static_cast<uint32_t>(w1) << weather0ShiftBits);
result |= (static_cast<uint32_t>(w2) << weather1ShiftBits);
result |= (static_cast<uint32_t>(w3) << weather2ShiftBits);
result |= (static_cast<uint32_t>(e) << eventShiftBits);
return result;
}
inline uint32_t WeatherPhenomena::pack(Qualifier q,
Descriptor d,
std::vector<Weather> w,
Event e)
{
const size_t sz = (w.size() <= 3 ? w.size() : 3);
const Weather w1 = (sz >= 1 ? w[0] : Weather::NOT_REPORTED);
const Weather w2 = (sz >= 2 ? w[1] : Weather::NOT_REPORTED);
const Weather w3 = (sz == 3 ? w[2] : Weather::NOT_REPORTED);
return pack(q, d, w.size(), w1, w2, w3, e);
}
std::optional <WeatherPhenomena> WeatherPhenomena::fromWeatherBeginEndString(
const std::string & s,
const MetafTime & reportTime,
const WeatherPhenomena & previous)
{
std::optional <WeatherPhenomena> error;
static const std::regex rgx("((?:[A-Z][A-Z]){0,4})([BE])(\\d\\d)?(\\d\\d)");
static const auto matchPhenomena = 1, matchEvent = 2;
static const auto matchHour = 3, matchMinute = 4;
std::smatch match;
if (!regex_match(s, match, rgx)) return error;
WeatherPhenomena result;
if (const auto phstr = match.str(matchPhenomena); !phstr.empty()) {
const auto ph = fromString(phstr);
if (!ph.has_value()) return error;
result = *ph;
} else {
if (!previous.isValid()) return error;
result = previous;
}
Event resultEvent;
if (match.str(matchEvent) == "B") resultEvent = Event::BEGINNING;
if (match.str(matchEvent) == "E") resultEvent = Event::ENDING;
result.data = pack(result.qualifier(),
result.descriptor(),
result.weather(),
resultEvent);
unsigned int hour = reportTime.hour();
unsigned int minute = static_cast<unsigned int>(std::stoi(match.str(matchMinute)));
if (const auto h = match.str(matchHour); !h.empty())
hour = static_cast<unsigned int>(std::stoi(h));
result.tm = MetafTime(hour, minute);
return result;
}
bool WeatherPhenomena::isValid() const {
const auto w = weather();
// Empty weather phenomena is not valid
if (qualifier() == Qualifier::NONE && descriptor() == Descriptor::NONE && !w.size())
return false;
// Event time must be valid if present
if (tm.has_value() && !tm->isValid()) return false;
// Descriptor FZ only makes sense with precipitation which
// can potentially freeze, i.e. DZ RA, or with UP, or with FG
if (descriptor() == Descriptor::FREEZING) {
bool dzRaUpFg = false;
for (auto i = 0u; i < wSize; i++) {
if (w[i] == Weather::DRIZZLE || w[i] == Weather::RAIN ||
w[i] == Weather::UNDETERMINED || w[i] == Weather::FOG)
{
dzRaUpFg = true; break;
}
}
if (!dzRaUpFg) return false;
}
// Everything else is valid
return true;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<CloudType> CloudType::fromString(const std::string & s) {
static const std::optional<CloudType> error;
if (s.empty()) return error;
if (s[0] >= '0' && s[0] <= '9') {
// Format with height 8NS070 or 3TCU022 (6 or 7 chars)
// std::regex("(\d)([A-Z][A-Z][A-Z]?)(\d\d\d)")
if (s.length() != 6 && s.length() != 7) return error;
static const auto heightDigits = 3u, oktaDigits = 1u;
const auto typeStrLen = s.length() - heightDigits - oktaDigits;
const auto heightValue =
Distance::fromHeightString(s.substr(s.length() - heightDigits));
if (!heightValue.has_value()) return error;
if (!heightValue->isReported()) return error;
const auto typeValue = cloudTypeFromString(s.substr(oktaDigits, typeStrLen));
if (typeValue == Type::NOT_REPORTED) return error;
return CloudType(typeValue, *heightValue, s[0] - '0');
} else {
// Format without height BLSN1 or SC1 (3 or more chars)
// std::regex("([A-Z][A-Z]+)(\d)")
if (s.length() < 3) return error;
const auto oktaCh = s[s.length() - 1];
if (oktaCh < '0' || oktaCh > '9') return error;
const auto typeValue =
cloudTypeOrObscurationFromString(s.substr(0, s.length() - 1));
if (typeValue == Type::NOT_REPORTED) return error;
return CloudType(typeValue, Distance(), oktaCh - '0');
}
}
std::optional<CloudType> CloudType::fromStringObscuration(const std::string & s) {
auto type = Type::NOT_REPORTED;
if (s == "BLSN") type = Type::BLOWING_SNOW;
if (s == "BLDU") type = Type::BLOWING_DUST;
if (s == "BLSA") type = Type::BLOWING_SAND;
if (s == "VA") type = Type::VOLCANIC_ASH;
if (s == "FU") type = Type::SMOKE;
if (s == "FG") type = Type::FOG;
if (type == Type::NOT_REPORTED) return std::optional<CloudType>();
return CloudType(type, Distance(), 0);
}
CloudType::Type CloudType::cloudTypeFromString(const std::string & s) {
if (s == "CB") return Type::CUMULONIMBUS;
if (s == "TCU") return Type::TOWERING_CUMULUS;
if (s == "CU") return Type::CUMULUS;
if (s == "CF") return Type::CUMULUS_FRACTUS;
if (s == "SC") return Type::STRATOCUMULUS;
if (s == "NS") return Type::NIMBOSTRATUS;
if (s == "ST") return Type::STRATUS;
if (s == "SF") return Type::STRATUS_FRACTUS;
if (s == "AS") return Type::ALTOSTRATUS;
if (s == "AC") return Type::ALTOCUMULUS;
if (s == "ACC") return Type::ALTOCUMULUS_CASTELLANUS;
if (s == "CI") return Type::CIRRUS;
if (s == "CS") return Type::CIRROSTRATUS;
if (s == "CC") return Type::CIRROCUMULUS;
return Type::NOT_REPORTED;
}
CloudType::Type CloudType::cloudTypeOrObscurationFromString(const std::string & s) {
if (const auto t = cloudTypeFromString(s); t != Type::NOT_REPORTED) return t;
if (s == "BLSN") return Type::BLOWING_SNOW;
if (s == "BLDU") return Type::BLOWING_DUST;
if (s == "BLSA") return Type::BLOWING_SAND;
if (s == "IC") return Type::ICE_CRYSTALS;
if (s == "RA") return Type::RAIN;
if (s == "DZ") return Type::DRIZZLE;
if (s == "SN") return Type::SNOW;
if (s == "PL") return Type::ICE_PELLETS;
if (s == "FU") return Type::SMOKE;
if (s == "FG") return Type::FOG;
if (s == "BR") return Type::MIST;
if (s == "HZ") return Type::HAZE;
if (s == "VA") return Type::VOLCANIC_ASH;
return Type::NOT_REPORTED;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<KeywordGroup> KeywordGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
if (reportPart == ReportPart::HEADER) {
if (group == "METAR") return KeywordGroup(Type::METAR);
if (group == "SPECI") return KeywordGroup(Type::SPECI);
if (group == "TAF") return KeywordGroup(Type::TAF);
if (group == "AMD") return KeywordGroup(Type::AMD);
}
if (reportPart == ReportPart::HEADER || reportPart == ReportPart::METAR) {
if (group == "COR") return KeywordGroup(Type::COR);
}
if (reportPart == ReportPart::HEADER ||
reportPart == ReportPart::METAR ||
reportPart == ReportPart::TAF) {
if (group == "NIL") return KeywordGroup(Type::NIL);
if (group == "CNL") return KeywordGroup(Type::CNL);
}
if (reportPart == ReportPart::METAR) {
if (group == "AUTO") return KeywordGroup(Type::AUTO);
}
if (reportPart == ReportPart::METAR || reportPart == ReportPart::TAF) {
if (group == "CAVOK") return KeywordGroup(Type::CAVOK);
if (group == "RMK") return KeywordGroup(Type::RMK);
}
if (reportPart == ReportPart::RMK) {
if (group == "AO1") return KeywordGroup(Type::AO1);
if (group == "AO2") return KeywordGroup(Type::AO2);
if (group == "AO1A") return KeywordGroup(Type::AO1A);
if (group == "AO2A") return KeywordGroup(Type::AO2A);
if (group == "NOSPECI") return KeywordGroup(Type::NOSPECI);
}
if (group == "$") return KeywordGroup(Type::MAINTENANCE_INDICATOR);
return std::optional<KeywordGroup>();
}
AppendResult KeywordGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)group; (void)reportMetadata; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<LocationGroup> LocationGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<LocationGroup> notRecognised;
if (reportPart != ReportPart::HEADER) return notRecognised;
static const std::regex rgx = std::regex("[A-Z][A-Z0-9]{3}");
if (!regex_match(group, rgx)) return notRecognised;
LocationGroup result;
strncpy(result.location, group.c_str(), locationLength);
result.location[locationLength] = '\0';
return result;
}
AppendResult LocationGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<ReportTimeGroup> ReportTimeGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<ReportTimeGroup> notRecognised;
static const std::regex rgx ("\\d\\d\\d\\d\\d\\dZ");
static const auto posTime = 0, lenTime = 6;
if (reportPart != ReportPart::HEADER) return notRecognised;
if (!regex_match(group, rgx)) return notRecognised;
const auto tm = MetafTime::fromStringDDHHMM(group.substr(posTime, lenTime));
if (!tm.has_value()) return notRecognised;
if (!tm->day().has_value()) return notRecognised;
ReportTimeGroup g;
g.t = *tm;
return g;
}
AppendResult ReportTimeGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<TrendGroup> TrendGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
if (reportPart == ReportPart::METAR || reportPart == ReportPart::TAF) {
// Detect trend type groups
if (group == "BECMG") return TrendGroup(Type::BECMG);
if (group == "TEMPO") return TrendGroup(Type::TEMPO);
if (group == "INTER") return TrendGroup(Type::INTER);
}
if (reportPart == ReportPart::TAF) {
// Detect probability groups
if (group == "PROB30") return TrendGroup(Probability::PROB_30);
if (group == "PROB40") return TrendGroup(Probability::PROB_40);
// Detect time span groups
if (auto timeSpan = fromTimeSpan(group); timeSpan.has_value()) return timeSpan;
// Detect FMxxxxxx groups
if (auto longFm = fromFm(group); longFm.has_value()) return longFm;
}
if (reportPart == ReportPart::METAR){
// Detect NOSIG trend type
if (group == "NOSIG") return TrendGroup(Type::NOSIG);
// Detect FMxxxx /TLxxxx /ATxxxx
if (auto trendTime = fromTrendTime(group); trendTime.has_value()) return trendTime;
// Detect time span in format HHMM/HHMM used in Australia
if (auto timeSpan = fromTimeSpanHHMM(group); timeSpan.has_value()) return timeSpan;
}
if (reportPart == ReportPart::HEADER || reportPart == ReportPart::TAF) {
// Detect time span
if (auto ts = fromTimeSpan(group); ts.has_value()) return ts;
}
// Cannot detect group
return std::optional<TrendGroup>();
}
AppendResult TrendGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
if (type() == Type::NOSIG) return AppendResult::NOT_APPENDED;
const auto nextGroup = parse(group, reportPart, reportMetadata);
if (!nextGroup.has_value()) return AppendResult::NOT_APPENDED;
if (combineProbAndTrendTypeGroups(*nextGroup)) return AppendResult::APPENDED;
if (combineTrendTypeAndTimeGroup(*nextGroup)) return AppendResult::APPENDED;
if (combineProbAndTimeSpanGroups(*nextGroup)) return AppendResult::APPENDED;
if (combineIncompleteGroups(*nextGroup)) return AppendResult::APPENDED;
return AppendResult::NOT_APPENDED;
}
std::optional<TrendGroup> TrendGroup::fromTimeSpan(const std::string & s) {
static const std::optional<TrendGroup> notRecognised;
static const std::regex rgx("(\\d\\d\\d\\d)/(\\d\\d\\d\\d)");
static const auto matchFrom = 1, matchTill = 2;
std::smatch match;
if (!regex_match(s, match, rgx)) return notRecognised;
const auto from = MetafTime::fromStringDDHH(match.str(matchFrom));
const auto till = MetafTime::fromStringDDHH(match.str(matchTill));
if (!from.has_value() || !till.has_value()) return notRecognised;
TrendGroup result;
result.t = Type::TIME_SPAN;
result.isTafTimeSpanGroup = true;
result.tFrom = from;
result.tTill = till;
return result;
}
std::optional<TrendGroup> TrendGroup::fromTimeSpanHHMM(const std::string & s) {
static const std::optional<TrendGroup> notRecognised;
static const std::regex rgx("(\\d\\d\\d\\d)/(\\d\\d\\d\\d)");
static const auto matchFrom = 1, matchTill = 2;
std::smatch match;
if (!regex_match(s, match, rgx)) return notRecognised;
const auto from = MetafTime::fromStringDDHHMM(match.str(matchFrom));
const auto till = MetafTime::fromStringDDHHMM(match.str(matchTill));
if (!from.has_value() || !till.has_value()) return notRecognised;
TrendGroup result;
result.t = Type::TIME_SPAN;
result.isTafTimeSpanGroup = true;
result.tFrom = from;
result.tTill = till;
return result;
}
std::optional<TrendGroup> TrendGroup::fromFm(const std::string & s) {
static const std::optional<TrendGroup> notRecognised;
static const std::regex rgx("FM\\d\\d\\d\\d\\d\\d");
static const auto posTime = 2, lenTime = 6;
if (!regex_match(s, rgx)) return notRecognised;
const auto time = MetafTime::fromStringDDHHMM(s.substr(posTime, lenTime));
if (!time.has_value()) return notRecognised;
TrendGroup result;
result.t = Type::FROM;
result.tFrom = time;
return result;
}
std::optional<TrendGroup> TrendGroup::fromTrendTime(const std::string & s) {
static const std::optional<TrendGroup> notRecognised;
static const std::regex rgx("([FTA][MLT])(\\d\\d\\d\\d)");
static const auto matchType = 1, matchTime = 2;
std::smatch match;
if (!regex_match(s, match, rgx)) return notRecognised;
const auto time = MetafTime::fromStringDDHHMM(match.str(matchTime));
if (!time.has_value()) return notRecognised;
TrendGroup result;
if (match.str(matchType) == "FM") {
result.t = Type::FROM;
result.tFrom = time;
return result;
}
if (match.str(matchType) == "TL") {
result.t = Type::UNTIL;
result.tTill = time;
return result;
}
if (match.str(matchType) == "AT") {
result.t = Type::AT;
result.tAt = time;
return result;
}
return notRecognised;
}
bool TrendGroup::combineProbAndTrendTypeGroups(const TrendGroup & nextTrendGroup) {
if (!isProbabilityGroup()) return false;
if (!nextTrendGroup.isTrendTypeGroup()) return false;
if (nextTrendGroup.type() != Type::TEMPO &&
nextTrendGroup.type() != Type::INTER) return false;
t = nextTrendGroup.type();
return true;
}
bool TrendGroup::combineTrendTypeAndTimeGroup(const TrendGroup & nextTrendGroup) {
if (type() != Type::BECMG &&
type() != Type::TEMPO &&
type() != Type::INTER) return false;
if (!nextTrendGroup.isTimeSpanGroup() &&
!nextTrendGroup.isTrendTimeGroup()) return false;
if (!canCombineTime(*this, nextTrendGroup)) return false;
combineTime(nextTrendGroup);
return true;
}
bool TrendGroup::combineProbAndTimeSpanGroups(const TrendGroup & nextTrendGroup) {
if (!isProbabilityGroup()) return false;
if (!nextTrendGroup.isTimeSpanGroup()) return false;
combineTime(nextTrendGroup);
t = Type::TIME_SPAN;
return true;
}
bool TrendGroup::combineIncompleteGroups(const TrendGroup & nextTrendGroup) {
if (probability() != Probability::NONE ||
type() != Type::FROM ||
nextTrendGroup.type() != Type::UNTIL) return false;
t = Type::TIME_SPAN;
tTill = nextTrendGroup.tTill;
return true;
}
bool TrendGroup::isProbabilityGroup() const {
// Probability group has format PROB30 or PROB40
// Probability must be reported and no time allowed
if (type() != Type::PROB) return false;
if (probability() == Probability::NONE) return false;
if (timeFrom().has_value() || timeUntil().has_value()) return false;
if (timeAt().has_value()) return false;
return true;
}
bool TrendGroup::isTrendTypeGroup() const {
// Trend type group is a group BECMG / TEMPO / INTER
// No probability or time allowed
if (type() != Type::BECMG &&
type() != Type::TEMPO &&
type() != Type::INTER) return false;
if (probability() != Probability::NONE) return false;
if (timeFrom().has_value() || timeUntil().has_value()) return false;
if (timeAt().has_value()) return false;
return true;
}
bool TrendGroup::isTrendTimeGroup() const {
// Trend time group has format FMxxxx, TLxxxx, ATxxxx
// Only one time from timeFrom, timeUntil or timeAt can be reported
if (type() != Type::FROM && type() != Type::UNTIL && type() != Type::AT)
return false;
if (probability() != Probability::NONE) return false;
if (!timeFrom() && !timeUntil() && !timeAt()) return false;
if (timeFrom() && timeUntil()) return false;
if (timeFrom() && timeAt()) return false;
if (timeUntil() && timeAt()) return false;
return true;
}
bool TrendGroup::isTimeSpanGroup() const {
// Time span group has format DDHH/DDHH,
// only time 'from' and 'till' must be reported
// isTafTimeSpanGroup guarantees that DDHH/DDHH group is
// not confused with appended groups FMxxxx TLxxxx and HHMM/HHMM
if (type() != Type::TIME_SPAN ||
!isTafTimeSpanGroup ||
probability() != Probability::NONE ||
!timeFrom().has_value() ||
!timeUntil().has_value()) return false;
if (timeAt().has_value()) return false;
return true;
}
bool TrendGroup::canCombineTime(const TrendGroup & g1, const TrendGroup & g2) {
// Cannot combine time 'from' with 'from', 'till' with 'till', 'at' with 'at'
if (g1.timeFrom().has_value() && g2.timeFrom().has_value()) return false;
if (g1.timeUntil().has_value() && g2.timeUntil().has_value()) return false;
if (g1.timeAt().has_value() && g2.timeAt().has_value()) return false;
// Cannot combine time 'from' or 'till' with 'at'
if (g1.timeAt().has_value() &&
(g2.timeFrom().has_value() || g2.timeUntil().has_value())) return false;
if (g2.timeAt().has_value() &&
(g1.timeFrom().has_value() || g1.timeUntil().has_value())) return false;
return true;
}
void TrendGroup::combineTime(const TrendGroup & nextTrendGroup) {
if (!timeFrom().has_value()) tFrom = nextTrendGroup.timeFrom();
if (!timeUntil().has_value()) tTill = nextTrendGroup.timeUntil();
if (!timeAt().has_value()) tAt = nextTrendGroup.timeAt();
}
///////////////////////////////////////////////////////////////////////////////
std::optional<WindGroup> WindGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<WindGroup> notRecognised;
if (reportPart == ReportPart::METAR) {
if (group == "WS") return WindGroup(Type::WIND_SHEAR_IN_LOWER_LAYERS, IncompleteText::WS);
}
if (reportPart == ReportPart::TAF) {
if (group == "WSCONDS") return WindGroup(Type::WSCONDS);
}
if (reportPart == ReportPart::RMK) {
if (group == "WSHFT") return WindGroup(Type::WIND_SHIFT);
if (group == "PK") return WindGroup(Type::PEAK_WIND, IncompleteText::PK);
if (group == "WND") return WindGroup(Type::WND_MISG, IncompleteText::WND);
}
if (reportPart != ReportPart::METAR &&
reportPart != ReportPart::TAF) return notRecognised;
if (const auto result = parseVariableSector(group); result.has_value())
return *result;
static const std::regex windRgx("(?:WS(\\d\\d\\d)/)?"
"(\\d\\d0|VRB|///)([1-9]?\\d\\d|//)(?:G([1-9]?\\d\\d))?([KM][TMP][HS]?)");
static const auto matchWindShearHeight = 1, matchWindDir = 2;
static const auto matchWindSpeed = 3, matchWindGust = 4, matchWindUnit = 5;
// Surface wind or wind shear, e.g. dd0ssKT or dd0ssGggMPS or WShhhdd0ssGggKT
if (std::smatch match; std::regex_match(group, match, windRgx)) {
const auto speedUnit = Speed::unitFromString(match.str(matchWindUnit));
if (!speedUnit.has_value()) return notRecognised;
const auto speed = Speed::fromString(match.str(matchWindSpeed), *speedUnit);
if (!speed.has_value()) return notRecognised;
WindGroup result;
if (!match.length(matchWindShearHeight) &&
!match.length(matchWindGust) &&
match.str(matchWindDir) == "000" &&
match.str(matchWindSpeed) == "00")
{
//00000KT or 00000MPS or 00000KMH: calm wind
result.windType = Type::SURFACE_WIND_CALM;
result.wSpeed = *speed;
return result;
}
const auto dir = Direction::fromDegreesString(match.str(matchWindDir));
if (!dir.has_value()) return notRecognised;
result.windDir = *dir;
result.wSpeed = *speed;
const auto gust = Speed::fromString(match.str(matchWindGust), *speedUnit);
if (gust.has_value()) result.gSpeed = *gust;
const auto wsHeight = Distance::fromHeightString(match.str(matchWindShearHeight));
result.windType = Type::SURFACE_WIND;
if (wsHeight.has_value()) {
result.windType = Type::WIND_SHEAR;
result.wShHeight = *wsHeight;
}
return result;
}
return notRecognised;
}
AppendResult WindGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportPart; (void)reportMetadata;
//Append variable wind sector group to surface wind group
switch (incompleteText) {
case IncompleteText::NONE:
switch (type()) {
case Type::SURFACE_WIND: return appendVariableSector(group);
case Type::WIND_SHIFT: return appendWindShift(group, reportMetadata);
default: return AppendResult::NOT_APPENDED;
}
case IncompleteText::PK:
if (group != "WND") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::PK_WND;
return AppendResult::APPENDED;
case IncompleteText::PK_WND:
return appendPeakWind(group, reportMetadata);
case IncompleteText::WND:
if (group != "MISG") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
case IncompleteText::WS_ALL:
if (group != "RWY") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::NONE;
rw = Runway::makeAllRunways();
return AppendResult::APPENDED;
case IncompleteText::WS:
if (group == "ALL") {
incompleteText = IncompleteText::WS_ALL;
return AppendResult::APPENDED;
}
if (const auto r = Runway::fromString(group, true); r.has_value()) {
incompleteText = IncompleteText::NONE;
rw = r;
return AppendResult::APPENDED;
}
return AppendResult::GROUP_INVALIDATED;
}
}
std::optional<WindGroup> WindGroup::parseVariableSector(const std::string & group) {
static const std::optional<WindGroup> notRecognised;
static const std::regex varWindRgx("(\\d\\d0)V(\\d\\d0)");
static const auto matchVarWindBegin = 1, matchVarWindEnd = 2;
std::smatch match;
if (!std::regex_match(group, match, varWindRgx)) return notRecognised;
WindGroup result;
const auto begin = Direction::fromDegreesString(match.str(matchVarWindBegin));
if (!begin.has_value()) return notRecognised;
result.vsecBegin = *begin;
const auto end = Direction::fromDegreesString(match.str(matchVarWindEnd));
if (!end.has_value()) return notRecognised;
result.vsecEnd = *end;
result.windType = Type::VARIABLE_WIND_SECTOR;
return result;
}
AppendResult WindGroup::appendVariableSector(const std::string & group) {
if (const auto vs = parseVariableSector(group); vs.has_value()) {
windType = Type::SURFACE_WIND_WITH_VARIABLE_SECTOR;
vsecBegin = vs->vsecBegin;
vsecEnd = vs->vsecEnd;
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
AppendResult WindGroup::appendPeakWind(const std::string & group,
const ReportMetadata & reportMetadata)
{
static const std::regex pkWndRgx("(\\d\\d0)([1-9]?\\d\\d)/(\\d\\d)?(\\d\\d)");
static const auto matchDir = 1, matchSpeed = 2;
static const auto matchHour = 3, matchMinute = 4;
std::smatch match;
if (!std::regex_match(group, match, pkWndRgx)) return AppendResult::GROUP_INVALIDATED;
windType = Type::PEAK_WIND;
const auto dir = Direction::fromDegreesString(match.str(matchDir));
if (!dir.has_value()) return AppendResult::GROUP_INVALIDATED;
windDir = *dir;
const auto speed =
Speed::fromString(match.str(matchSpeed), Speed::Unit::KNOTS);
if (!speed.has_value()) return AppendResult::GROUP_INVALIDATED;
wSpeed = *speed;
if (!reportMetadata.reportTime.has_value() && match.str(matchHour).empty()) {
return AppendResult::GROUP_INVALIDATED;
}
const auto hour = match.str(matchHour).empty() ?
reportMetadata.reportTime->hour() : stoi(match.str(matchHour));
const auto minute = stoi(match.str(matchMinute));
evTime = MetafTime(hour, minute);
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
AppendResult WindGroup::appendWindShift(const std::string & group,
const ReportMetadata & reportMetadata)
{
//Append FROPA to wind shift group with or without time
if (group == "FROPA") {
windType = Type::WIND_SHIFT_FROPA;
return AppendResult::APPENDED;
}
if (eventTime().has_value()) return AppendResult::NOT_APPENDED;
//Append 2-digit time to WSHFT
if (!eventTime().has_value() &&
reportMetadata.reportTime.has_value() &&
group.length() == 2)
{
const auto minuteVal = strToUint(group, 0, 2);
if (!minuteVal.has_value()) return AppendResult::NOT_APPENDED;
evTime = MetafTime(reportMetadata.reportTime->hour(), *minuteVal);
return AppendResult::APPENDED;
}
//Append 4-digit time to WSHFT
if (!eventTime().has_value() && group.length() == 4)
{
const auto hourMinuteVal = strToUint(group, 0, 4);
if (!hourMinuteVal.has_value()) return AppendResult::NOT_APPENDED;
// hourMinuteVal.value() has 4 digits, format hhmm
const auto hour = *hourMinuteVal / 100;
const auto minute = *hourMinuteVal % 100;
evTime = MetafTime (hour, minute);
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
bool WindGroup::isValid() const {
if (incompleteText != IncompleteText::NONE) return false;
if (!gustSpeed().speed().value_or(1)) return false;
if (!height().distance().value_or(1)) return false;
if (!runway().value_or(Runway()).isValid()) return false;
if (!eventTime().value_or(MetafTime()).isValid()) return false;
if (windSpeed().speed().value_or(0) >= gustSpeed().speed().value_or(999))
return false; // if wind speed cannot be greater than gust speed
return (direction().isValid() &&
height().isValid() &&
varSectorBegin().isValid() &&
varSectorEnd().isValid());
}
///////////////////////////////////////////////////////////////////////////
std::optional<VisibilityGroup> VisibilityGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
if (reportPart == ReportPart::RMK) {
if (group == "VIS")
return VisibilityGroup(Type::PREVAILING, IncompleteText::VIS);
if (group == "SFC")
return VisibilityGroup(Type::SURFACE, IncompleteText::SFC_OR_TWR);
if (group == "TWR")
return VisibilityGroup(Type::TOWER, IncompleteText::SFC_OR_TWR);
if (group == "RVRNO")
return VisibilityGroup(Type::RVRNO, IncompleteText::NONE);
if (group == "VISNO")
return VisibilityGroup(Type::VISNO, IncompleteText::VISNO);
if (group == "RVR")
return VisibilityGroup(Type::RVR_MISG, IncompleteText::RVR);
}
if (reportPart == ReportPart::METAR || reportPart == ReportPart::TAF) {
if (const auto v = fromIncompleteInteger(group); v.has_value()) return v;
if (const auto v = fromMeters(group); v.has_value()) return v;
if (const auto v = Distance::fromMileString(group); v.has_value()) {
VisibilityGroup result;
result.vis = *v;
return result;
}
}
if (reportPart == ReportPart::METAR) {
if (const auto v = fromRvr(group); v.has_value()) return v;
}
return std::optional<VisibilityGroup>();
}
AppendResult VisibilityGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportPart;(void)reportMetadata;
switch (incompleteText) {
case IncompleteText::NONE:
return AppendResult::NOT_APPENDED;
case IncompleteText::INTEGER:
if (appendFractionToIncompleteInteger(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::VIS:
if (group == "MISG") {
visType = Type::VIS_MISG;
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
if (appendDirection(group, IncompleteText::VIS_DIR)) return AppendResult::APPENDED;
if (appendInteger(group, IncompleteText::VIS_INTEGER)) return AppendResult::APPENDED;
if (appendFraction(group, IncompleteText::VIS_FRACTION_OR_METERS)) return AppendResult::APPENDED;
if (appendVariable(group, IncompleteText::VIS_VAR_MAX_INT, IncompleteText::VIS_VAR)) return AppendResult::APPENDED;
if (appendMeters(group, IncompleteText::VIS_FRACTION_OR_METERS)) return AppendResult::APPENDED;
if (appendVariableMeters(group, IncompleteText::VIS_VAR)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::VIS_INTEGER:
if (appendVariable(group, IncompleteText::VIS_VAR_MAX_INT, IncompleteText::VIS_VAR)) return AppendResult::APPENDED;
if (appendFraction(group, IncompleteText::VIS_FRACTION_OR_METERS)) return AppendResult::APPENDED;
if (appendRunway(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::VIS_VAR_MAX_INT:
if (appendVariableMaxFraction(group, IncompleteText::VIS_VAR)) return AppendResult::APPENDED;
if (appendRunway(group)) return AppendResult::APPENDED;
incompleteText = IncompleteText::NONE;
return AppendResult::NOT_APPENDED;
case IncompleteText::VIS_VAR:
if (appendRunway(group)) return AppendResult::APPENDED;
incompleteText = IncompleteText::NONE;
return AppendResult::NOT_APPENDED;
case IncompleteText::VIS_FRACTION_OR_METERS:
if (appendRunway(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::VIS_DIR:
if (appendInteger(group, IncompleteText::VIS_DIR_INTEGER)) return AppendResult::APPENDED;
if (appendVariable(group, IncompleteText::VIS_DIR_VAR_MAX_INT)) return AppendResult::APPENDED;
if (appendFraction(group)) return AppendResult::APPENDED;
if (appendVariableMeters(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::VIS_DIR_INTEGER:
if (appendFraction(group)) return AppendResult::APPENDED;
if (appendVariable(group, IncompleteText::VIS_DIR_VAR_MAX_INT)) return AppendResult::APPENDED;
incompleteText = IncompleteText::NONE;
return AppendResult::NOT_APPENDED;
case IncompleteText::VIS_DIR_VAR_MAX_INT:
if (appendVariableMaxFraction(group)) return AppendResult::APPENDED;
incompleteText = IncompleteText::NONE;
return AppendResult::NOT_APPENDED;
case IncompleteText::SFC_OR_TWR:
if (group == "VIS") {
incompleteText = IncompleteText::SFC_OR_TWR_VIS;
return AppendResult::APPENDED;
}
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::SFC_OR_TWR_VIS:
if (appendInteger(group, IncompleteText::SFC_OR_TWR_VIS_INTEGER)) return AppendResult::APPENDED;
if (appendFraction(group)) return AppendResult::APPENDED;
if (appendMeters(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::SFC_OR_TWR_VIS_INTEGER:
if (appendFraction(group)) return AppendResult::APPENDED;
if (appendVariable(group)) return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::NONE;
return AppendResult::NOT_APPENDED;
case IncompleteText::RVR:
if (group == "MISG") {
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::VISNO:
if (appendRunway(group)) return AppendResult::APPENDED;
if (appendDirection(group)) return AppendResult::APPENDED;
incompleteText = IncompleteText::NONE;
return AppendResult::NOT_APPENDED;
}
}
std::optional<VisibilityGroup> VisibilityGroup::fromIncompleteInteger(
const std::string & group)
{
static const std::optional<VisibilityGroup> error;
VisibilityGroup result;
if (!result.appendInteger(group)) return error;
if (result.visibility().modifier() != Distance::Modifier::NONE) return error;
result.incompleteText = IncompleteText::INTEGER;
return result;
}
std::optional<VisibilityGroup> VisibilityGroup::fromMeters(
const std::string & group)
{
static const std::optional<VisibilityGroup> notRecognised;
static const std::regex rgx("(\\d\\d\\d\\d|////)([NSWE][WED]?[V]?)?");
static const auto matchVis = 1, matchDir = 2;
std::smatch match;
if (std::regex_match(group, match, rgx)) {
const auto v = Distance::fromMeterString(match.str(matchVis));
if (!v.has_value()) return notRecognised;
const auto d = Direction::fromCardinalString(match.str(matchDir));
VisibilityGroup result;
result.vis = *v;
result.dir = d;
if (result.dir.has_value()) {
if (result.dir->isValue()) result.visType = Type::DIRECTIONAL;
if (result.dir->type() == Direction::Type::NDV) result.visType = Type::PREVAILING_NDV;
}
return result;
}
return notRecognised;
}
std::optional<VisibilityGroup> VisibilityGroup::fromRvr(const std::string & group) {
static const std::optional<VisibilityGroup> notRecognised;
static const std::regex rgx("(R\\d\\d[RCL]?|R//)/(////|[PM]?\\d\\d\\d\\d)"
"(?:V([PM]?\\d\\d\\d\\d))?(FT/?)?([UND/])?");
static const auto matchRunway = 1, matchRvr = 2, matchVarRvr = 3, matchUnit = 4;
static const auto matchTrend = 5;
std::smatch match;
if (!regex_match(group, match, rgx)) return notRecognised;
const bool unitFeet = match.length(matchUnit);
if (match.str(matchRunway) == "R//" && match.str(matchRvr) != "////")
return notRecognised;
if (match.str(matchRunway) == "R//" && match.str(matchTrend) == "/")
return notRecognised;
const auto runway = Runway::fromString(match.str(matchRunway));
if (!runway.has_value() && match.str(matchRunway) != "R//") return notRecognised;
const auto rvr = Distance::fromRvrString(match.str(matchRvr), unitFeet);
if (!rvr.has_value()) return notRecognised;
VisibilityGroup result;
result.visType = Type::RVR;
result.rw = runway;
result.vis = *rvr;
result.rvrTrend = trendFromString(match.str(matchTrend));
if (match.length(matchVarRvr)) {
const auto varRvr = Distance::fromRvrString(match.str(matchVarRvr), unitFeet);
if (!varRvr.has_value()) return notRecognised;
result.visType = Type::VARIABLE_RVR;
result.visMax = *varRvr;
}
return result;
}
bool VisibilityGroup::appendFractionToIncompleteInteger(const std::string & group,
IncompleteText next)
{
const auto v = Distance::fromMileString(group);
if (!v.has_value()) return false;
const auto vAppended = Distance::fromIntegerAndFraction(visibility(), *v);
if (!vAppended.has_value()) return false;
vis = *vAppended;
incompleteText = next;
return true;
}
bool VisibilityGroup::appendDirection(const std::string & group, IncompleteText next) {
if (const auto d = Direction::fromCardinalString(group); d.has_value()) {
dir = d;
if (visType == Type::PREVAILING) visType = Type::DIRECTIONAL;
incompleteText = next;
return true;
}
if (const auto d = Direction::fromSectorString(group); d.has_value()) {
dirSecFrom = std::get<0>(*d);
dirSecTo = std::get<1>(*d);
if (visType == Type::PREVAILING) visType = Type::SECTOR;
incompleteText = next;
return true;
}
return false;
}
bool VisibilityGroup::appendRunway(const std::string & group, IncompleteText next) {
const auto r = Runway::fromString(group, true);
if (!r.has_value()) return false;
rw = r;
if (type() == Type::PREVAILING) visType = Type::RUNWAY;
if (type() == Type::VARIABLE_PREVAILING) visType = Type::VARIABLE_RUNWAY;
incompleteText = next;
return true;
}
bool VisibilityGroup::appendInteger(const std::string & group, IncompleteText next) {
if (group.empty() || group.length() > 3) return false;
if (group.find('/') != std::string::npos) return false;
if (vis.isReported()) return false;
const auto v = Distance::fromMileString(group, true);
if (!v.has_value()) return false;
vis = *v;
incompleteText = next;
return true;
}
bool VisibilityGroup::appendFraction(const std::string & group, IncompleteText next) {
if (group.find('/') == std::string::npos) return false;
const auto v = Distance::fromMileString(group, true);
if (!v.has_value()) return false;
if (vis.isReported()) {
const auto d = Distance::fromIntegerAndFraction(vis, std::move(*v));
if (!d.has_value()) return false;
vis = std::move(*d);
} else {
vis = std::move(*v);
}
incompleteText = next;
return true;
}
bool VisibilityGroup::appendVariableMaxFraction(const std::string & group, IncompleteText next) {
const auto fraction = fractionStrToUint(group, 0, group.length());
if (!fraction.has_value()) return false;
const auto numerator = std::get<0>(*fraction);
const auto denominator = std::get<1>(*fraction);
const auto v = Distance(numerator, denominator);
if (!v.isValue()) return false;
const auto t = Distance::fromIntegerAndFraction(visMax, v);
if (!t.has_value()) return false;
visMax = *t;
incompleteText = next;
return true;
}
bool VisibilityGroup::appendVariable(const std::string & group,
IncompleteText nextIfMaxIsInteger,
IncompleteText nextIfMaxIsFraction)
{
const auto vPos = group.find('V');
if (vPos == std::string::npos ||
!vPos ||
vPos == group.length()) return false;
const bool maxInteger = (group.find('/', vPos) == std::string::npos);
const auto min =
Distance::fromMileString(group.substr(0, vPos), true);
if (!min.has_value()) return false;
const auto max =
Distance::fromMileString(group.substr(vPos + 1), true);
if (!max.has_value()) return false;
if (vis.isReported()) {
const auto v = Distance::fromIntegerAndFraction(vis, std::move(*min));
if (!v.has_value()) return false;
vis = std::move(*v);
} else {
vis = std::move(*min);
}
visMax = std::move(*max);
makeVariable();
incompleteText = maxInteger ? nextIfMaxIsInteger : nextIfMaxIsFraction;
return true;
}
bool VisibilityGroup::appendMeters(const std::string & group, IncompleteText next) {
const auto v = Distance::fromMeterString(group);
if (!v.has_value()) return false;
if (!v->isReported()) return false;
vis = *v;
incompleteText = next;
return true;
}
bool VisibilityGroup::appendVariableMeters(const std::string & group, IncompleteText next) {
static const std::regex rgx("(\\d\\d\\d\\d)V(\\d\\d\\d\\d)");
static const auto matchMin = 1, matchMax = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return false;
const auto min = Distance::fromMeterString(match.str(matchMin));
if (!min.has_value()) return false;
const auto max = Distance::fromMeterString(match.str(matchMax));
if (!max.has_value()) return false;
if (!min->isReported() || !max->isReported()) return false;
vis = *min;
visMax = *max;
makeVariable();
incompleteText = next;
return true;
}
VisibilityGroup::Trend VisibilityGroup::trendFromString(const std::string & s) {
if (s == "/") return Trend::NOT_REPORTED;
if (s == "U") return Trend::UPWARD;
if (s == "N") return Trend::NEUTRAL;
if (s == "D") return Trend::DOWNWARD;
return Trend::NONE;
}
bool VisibilityGroup::isValid() const {
if (const auto max = visMax.toUnit(vis.unit()); max.has_value()) {
const auto min = vis.toUnit(vis.unit());
if (!min.has_value()) return false;
if (*min > *max) return false;
}
if (incompleteText != IncompleteText::NONE) return false;
if (dir.has_value() && !dir->isValid()) return false;
if (rw.has_value() && !rw->isValid()) return false;
return (vis.isValid() && visMax.isValid());
}
///////////////////////////////////////////////////////////////////////////
std::optional<CloudGroup> CloudGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
if (reportPart == ReportPart::METAR || reportPart == ReportPart::TAF)
return parseCloudLayerOrVertVis(group);
if (reportPart == ReportPart::RMK) {
if (group == "CLD") return CloudGroup(Type::CLD_MISG, IncompleteText::CLD);
if (group == "CIG") return CloudGroup(Type::CEILING, IncompleteText::CIG);
if (group == "CHINO") return CloudGroup(Type::CHINO, IncompleteText::CHINO);
if (const auto ct = CloudType::fromStringObscuration(group); ct.has_value()) {
CloudGroup result = CloudGroup(Type::OBSCURATION, IncompleteText::OBSCURATION);
result.cldTp = *ct;
return result;
}
return parseVariableCloudLayer(group);
}
return std::optional<CloudGroup>();
}
AppendResult CloudGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)reportPart;
switch (incompleteText) {
case IncompleteText::NONE:
return AppendResult::NOT_APPENDED;
case IncompleteText::RMK_AMOUNT:
if (group != "V") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::RMK_AMOUNT_V;
return AppendResult::APPENDED;
case IncompleteText::RMK_AMOUNT_V:
return appendVariableCloudAmount(group);
case IncompleteText::CIG:
return appendCeiling(group);
case IncompleteText::CIG_NUM:
case IncompleteText::CHINO:
return appendRunwayOrCardinalDirection(group);
case IncompleteText::CLD:
if (group != "MISG") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
case IncompleteText::OBSCURATION:
return appendObscuration(group);
}
}
std::optional<CloudGroup> CloudGroup::parseCloudLayerOrVertVis(const std::string & s) {
static const std::optional<CloudGroup> notRecognised;
// Attempt to parse 'no cloud' groups
if (s == "NCD") return CloudGroup(Type::NO_CLOUDS, Amount::NCD);
if (s == "NSC") return CloudGroup(Type::NO_CLOUDS, Amount::NSC);
if (s == "CLR") return CloudGroup(Type::NO_CLOUDS, Amount::NONE_CLR);
if (s == "SKC") return CloudGroup(Type::NO_CLOUDS, Amount::NONE_SKC);
//Attempt to parse cloud layer or vertical visibility
std::smatch match;
static const std::regex rgx(
"([A-Z][A-Z][A-Z]?|///)(\\d\\d\\d|///)([CT][BC][U]?|///)?");
static const auto matchAmount = 1, matchHeight = 2, matchCnvType = 3;
if (!std::regex_match(s, match, rgx)) return notRecognised;
const auto amount = amountFromString(match.str(matchAmount));
if (!amount.has_value()) return notRecognised;
const auto height = Distance::fromHeightString(match.str(matchHeight));
if (!height.has_value()) return notRecognised;
const auto cnvtype = convectiveTypeFromString(match.str(matchCnvType));
if (!cnvtype.has_value()) return notRecognised;
// If vertical visibility is given, convective cloud type must not be specified
if (*amount == Amount::OBSCURED && *cnvtype != ConvectiveType::NONE)
return notRecognised;
CloudGroup result;
result.tp = Type::CLOUD_LAYER;
if (amount == Amount::OBSCURED) result.tp = Type::VERTICAL_VISIBILITY;
result.amnt = *amount;
result.heightOrVertVis = *height;
result.convtype = *cnvtype;
return result;
}
std::optional<CloudGroup> CloudGroup::parseVariableCloudLayer(const std::string & s) {
static const std::optional<CloudGroup> notRecognised;
std::smatch match;
static const std::regex rgx("([A-Z][A-Z][A-Z])(\\d\\d\\d)?");
static const auto matchAmount = 1, matchHeight = 2;
if (!std::regex_match(s, match, rgx)) return notRecognised;
CloudGroup result;
result.tp = Type::CLOUD_LAYER;
result.incompleteText = IncompleteText::RMK_AMOUNT;
const auto amount = amountFromString(match.str(matchAmount));
// Not checking for VV here because 3-char amount length guaranteed by regex
if (!amount.has_value()) return notRecognised;
result.amnt = *amount;
if (const std::string heightStr = match.str(matchHeight); !heightStr.empty()) {
const auto height = Distance::fromHeightString(heightStr);
if (!height.has_value()) return notRecognised;
result.heightOrVertVis = *height;
}
return result;
}
unsigned int CloudGroup::amountToMaxOkta(Amount a) {
switch (a) {
case Amount::FEW:
return 2;
case Amount::SCATTERED:
case Amount::VARIABLE_FEW_SCATTERED:
return 4;
case Amount::VARIABLE_SCATTERED_BROKEN:
case Amount::BROKEN:
return 7;
case Amount::VARIABLE_BROKEN_OVERCAST:
case Amount::OVERCAST:
case Amount::OBSCURED:
return 8;
default:
return 0;
}
}
CloudType::Type CloudGroup::convectiveTypeToCloudTypeType(ConvectiveType t) {
switch (t) {
case ConvectiveType::TOWERING_CUMULUS:
return CloudType::Type::TOWERING_CUMULUS;
case ConvectiveType::CUMULONIMBUS:
return CloudType::Type::CUMULONIMBUS;
default:
return CloudType::Type::NOT_REPORTED;
}
}
std::optional<CloudType> CloudGroup::cloudType() const {
const auto cldConvType = convectiveTypeToCloudTypeType(convectiveType());
const auto cldOkta = amountToMaxOkta(amount());
switch (type()) {
case Type::CLOUD_LAYER:
case Type::CEILING:
return CloudType(cldConvType, height(), cldOkta);
case Type::VARIABLE_CEILING:
return CloudType(cldConvType, minHeight(), cldOkta);
case Type::OBSCURATION:
return cldTp;
default:
return std::optional<CloudType>();
}
}
std::optional<CloudGroup::Amount> CloudGroup::amountFromString(const std::string & s) {
if (s == "FEW") return CloudGroup::Amount::FEW;
if (s == "SCT") return CloudGroup::Amount::SCATTERED;
if (s == "BKN") return CloudGroup::Amount::BROKEN;
if (s == "OVC") return CloudGroup::Amount::OVERCAST;
if (s == "VV") return CloudGroup::Amount::OBSCURED;
if (s == "///") return CloudGroup::Amount::NOT_REPORTED;
return std::optional<Amount>();
}
std::optional<CloudGroup::ConvectiveType> CloudGroup::convectiveTypeFromString(
const std::string & s)
{
if (s.empty()) return ConvectiveType::NONE;
if (s == "TCU") return ConvectiveType::TOWERING_CUMULUS;
if (s == "CB") return ConvectiveType::CUMULONIMBUS;
if (s == "///") return ConvectiveType::NOT_REPORTED;
return std::optional<ConvectiveType>();
}
AppendResult CloudGroup::appendVariableCloudAmount(const std::string & group) {
const auto newAmount = amountFromString(group);
if (!newAmount.has_value()) return AppendResult::GROUP_INVALIDATED;
const auto a1 = amount();
const auto a2 = *newAmount;
auto result = Amount::NOT_REPORTED;
if (a1 == Amount::FEW && a2 == Amount::SCATTERED) result = Amount::VARIABLE_FEW_SCATTERED;
if (a1 == Amount::SCATTERED && a2 == Amount::BROKEN) result = Amount::VARIABLE_SCATTERED_BROKEN;
if (a1 == Amount::BROKEN && a2 == Amount::OVERCAST) result = Amount::VARIABLE_BROKEN_OVERCAST;
if (result == Amount::NOT_REPORTED) return AppendResult::GROUP_INVALIDATED;
amnt = result;
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
AppendResult CloudGroup::appendCeiling(const std::string & group) {
if (const auto d = Distance::fromHeightString(group); d.has_value()) {
if (!d->isReported()) return AppendResult::GROUP_INVALIDATED;
heightOrVertVis = *d;
incompleteText = IncompleteText::CIG_NUM;
return AppendResult::APPENDED;
}
static const std::regex rgx ("(\\d\\d\\d)V(\\d\\d\\d)");
static const auto matchMinHeight = 1, matchMaxHeight = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return AppendResult::GROUP_INVALIDATED;
const auto minH = Distance::fromHeightString(match.str(matchMinHeight));
if (!minH.has_value()) return AppendResult::GROUP_INVALIDATED;
const auto maxH = Distance::fromHeightString(match.str(matchMaxHeight));
if (!maxH.has_value()) return AppendResult::GROUP_INVALIDATED;
heightOrVertVis = *minH;
maxHt = *maxH;
tp = Type::VARIABLE_CEILING;
incompleteText = IncompleteText::CIG_NUM;
return AppendResult::APPENDED;
}
AppendResult CloudGroup::appendRunwayOrCardinalDirection(const std::string & group) {
incompleteText = IncompleteText::NONE;
rw = Runway::fromString(group, true);
if (rw.has_value()) return AppendResult::APPENDED;
dir = Direction::fromCardinalString(group);
if (dir.has_value()) return AppendResult::APPENDED;
return AppendResult::NOT_APPENDED;
}
AppendResult CloudGroup::appendObscuration(const std::string & group) {
static const std::regex rgx("([A-Z][A-Z][A-Z])(\\d\\d\\d)");
static const auto matchAmount = 1, matchHeight = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return AppendResult::GROUP_INVALIDATED;
const auto h = Distance::fromHeightString(match.str(matchHeight));
if (!h.has_value()) return AppendResult::GROUP_INVALIDATED;
const auto a = amountFromString(match.str(matchAmount));
if (!a.has_value()) return AppendResult::GROUP_INVALIDATED;
amnt = *a;
heightOrVertVis = *h;
cldTp = CloudType(cldTp.type(), *h, amountToMaxOkta(*a));
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
///////////////////////////////////////////////////////////////////////////
std::optional<WeatherGroup> WeatherGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
std::optional<WeatherGroup> notRecognised;
if (reportPart == ReportPart::METAR || reportPart == ReportPart::TAF) {
if (group == "NSW") return WeatherGroup(Type::NSW);
if (const auto wp = parseWeatherWithoutEvent(group, reportPart); wp.has_value()) {
WeatherGroup result;
result.w[0] = *wp;
result.wsz = 1;
if (wp->qualifier() == WeatherPhenomena::Qualifier::RECENT) result.t = Type::RECENT;
return result;
}
}
if (reportPart == ReportPart::RMK) {
if (group == "PWINO") return WeatherGroup(Type::PWINO);
if (group == "TSNO") return WeatherGroup(Type::TSNO);
if (group == "WX") return WeatherGroup(Type::WX_MISG, IncompleteText::WX);
if (group == "TS/LTNG") return WeatherGroup(Type::TS_LTNG_TEMPO_UNAVBL, IncompleteText::TSLTNG);
if (!reportMetadata.reportTime.has_value()) return notRecognised;
return parseWeatherEvent(group, *reportMetadata.reportTime);
}
return notRecognised;
}
AppendResult WeatherGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
switch (incompleteText) {
case IncompleteText::NONE:
break;
case IncompleteText::WX:
if (group != "MISG") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
case IncompleteText::TSLTNG:
if (group != "TEMPO") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::TSLTNG_TEMPO;
return AppendResult::APPENDED;
case IncompleteText::TSLTNG_TEMPO:
if (group != "UNAVBL") return AppendResult::GROUP_INVALIDATED;
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
if (type() != Type::CURRENT && type() != Type::RECENT)
return AppendResult::NOT_APPENDED;
const auto wp = parseWeatherWithoutEvent(group, reportPart);
if (wp.has_value()) {
// Recent weather cannot be appended to current weather and vice versa
if (type() == Type::CURRENT &&
wp->qualifier() == WeatherPhenomena::Qualifier::RECENT) return AppendResult::NOT_APPENDED;
if (type() == Type::RECENT &&
wp->qualifier() != WeatherPhenomena::Qualifier::RECENT) return AppendResult::NOT_APPENDED;
if (!addWeatherPhenomena(*wp)) return AppendResult::NOT_APPENDED;
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
inline std::vector<WeatherPhenomena> WeatherGroup::weatherPhenomena() const {
std::vector<WeatherPhenomena> result;
for (auto i=0u; i < wsz; i++)
result.push_back(w[i]);
return result;
}
std::optional<WeatherPhenomena> WeatherGroup::parseWeatherWithoutEvent(
const std::string & group,
ReportPart reportPart)
{
std::optional<WeatherPhenomena> notRecognised;
if (reportPart != ReportPart::METAR && reportPart != ReportPart::TAF) return notRecognised;
// Not reported weather or recent weather is only allowed in METAR
if (reportPart == ReportPart::METAR) {
if (group == "RE//") return WeatherPhenomena::notReported(true);
if (group == "//") return WeatherPhenomena::notReported(false);
}
const auto wp = WeatherPhenomena::fromString(group, true);
if (!wp.has_value()) return notRecognised;
// RECENT qualifier is not allowed in TAF
if (reportPart == ReportPart::TAF &&
wp->qualifier() == WeatherPhenomena::Qualifier::RECENT) return notRecognised;
return wp;
}
std::optional<WeatherGroup> WeatherGroup::parseWeatherEvent(const std::string & group,
const MetafTime & reportTime)
{
std::optional<WeatherGroup> notRecognised;
int eventStartPos = 0;
bool lastDigit = false;
WeatherPhenomena previousWeather;
WeatherGroup result;
result.t = Type::EVENT;
for (auto i = 0u; i < group.length(); i++) {
// Split group into weather event strings
// Assuming that weather event always has digits at the end
const bool currDigit = (group[i] >= '0' && group[i] <= '9');
if (!currDigit && lastDigit) {
// i is the position after the last digit from eventStartPos
const auto eventLen = i - eventStartPos;
if (const auto minEventLen = 3; eventLen < minEventLen) return notRecognised;
const std::string s = group.substr(eventStartPos, eventLen);
const auto w =
WeatherPhenomena::fromWeatherBeginEndString(s, reportTime, previousWeather);
if (!w.has_value()) return notRecognised;
result.addWeatherPhenomena(*w);
eventStartPos = i;
previousWeather = *w;
}
lastDigit = currDigit;
}
// Last weather event in the string ends with a digit is not be detected in the loop
const std::string s = group.substr(eventStartPos);
const auto w =
WeatherPhenomena::fromWeatherBeginEndString(s, reportTime, previousWeather);
if (!w.has_value()) return notRecognised;
result.addWeatherPhenomena(*w);
return result;
}
bool WeatherGroup::addWeatherPhenomena(const WeatherPhenomena & wp) {
if (wsz >= wSize) return false;
w[wsz++] = wp;
return true;
}
///////////////////////////////////////////////////////////////////////////
bool TemperatureGroup::isValid() const {
if (isIncomplete) return false;
// Either temperature or dew point not reported: always valid
if (!airTemperature().temperature().has_value() ||
!dewPoint().temperature().has_value()) return true;
// If temperature reported M00 then dew point cannot be 00
if (!*airTemperature().temperature() &&
!*dewPoint().temperature() &&
airTemperature().isFreezing() &&
!dewPoint().isFreezing()) return false;
// Generally dew point must be less or equal to temperature
return (*airTemperature().temperature() >= *dewPoint().temperature());
}
std::optional<TemperatureGroup> TemperatureGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<TemperatureGroup> notRecognised;
static const std::regex rgx("(M?\\d\\d|//)/(M?\\d\\d|//)?");
static const auto matchTemperature = 1, matchDewPoint = 2;
static const std::regex rmkRgx("T([01]\\d\\d\\d)([01]\\d\\d\\d)?");
static const auto rmkMatchTemperature = 1, rmkMatchDewPoint = 2;
std::smatch match;
if (reportPart == ReportPart::METAR) {
if (regex_match(group, match, rgx)) {
const auto t = Temperature::fromString(match.str(matchTemperature));
if (!t.has_value()) return notRecognised;
TemperatureGroup result(Type::TEMPERATURE_AND_DEW_POINT);
result.t = *t;
if (match.length(matchDewPoint)) {
const auto dp = Temperature::fromString(match.str(matchDewPoint));
if (!dp.has_value()) return notRecognised;
result.dp = *dp;
}
return result;
}
}
if (reportPart == ReportPart::RMK) {
if (group == "T") return TemperatureGroup(Type::T_MISG, true);
if (group == "TD") return TemperatureGroup(Type::TD_MISG, true);
if (regex_match(group, match, rmkRgx)) {
const auto t = Temperature::fromRemarkString(match.str(rmkMatchTemperature));
if (!t.has_value()) return notRecognised;
TemperatureGroup result;
result.t = *t;
if (match.length(matchDewPoint)) {
const auto dp = Temperature::fromRemarkString(match.str(rmkMatchDewPoint));
if (!dp.has_value()) return notRecognised;
result.dp = *dp;
}
return result;
}
}
return notRecognised;
}
AppendResult TemperatureGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
if (isIncomplete && (type() == Type::T_MISG || type() == Type::TD_MISG)) {
if (group != "MISG") return AppendResult::GROUP_INVALIDATED;
isIncomplete = false;
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////
std::optional<PressureGroup> PressureGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<PressureGroup> notRecognised;
if (reportPart == ReportPart::METAR || reportPart == ReportPart::RMK) {
const auto pressure = Pressure::fromString(group);
if (pressure.has_value()) {
PressureGroup result;
result.p = *pressure;
result.t = Type::OBSERVED_QNH;
return result;
}
if (reportPart == ReportPart::METAR) return notRecognised;
}
if (reportPart == ReportPart::TAF) {
const auto pressure = Pressure::fromForecastString(group);
if (!pressure.has_value()) return notRecognised;
PressureGroup result;
result.p = *pressure;
result.t = Type::FORECAST_LOWEST_QNH;
return result;
}
if (reportPart == ReportPart::RMK) {
if (group == "SLPNO") return PressureGroup(Type::SLPNO);
if (group == "PRES") return PressureGroup(Type::PRES_MISG, true);
if (const auto pr = Pressure::fromSlpString(group); pr.has_value()) {
PressureGroup result;
result.p = *pr;
result.t = Type::OBSERVED_SLP;
return result;
}
if (const auto pr = Pressure::fromQfeString(group); pr.has_value()) {
PressureGroup result;
result.p = *pr;
result.t = Type::OBSERVED_QFE;
return result;
}
return notRecognised;
}
return notRecognised;
}
AppendResult PressureGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)reportPart;
if (isIncomplete && type() == Type::PRES_MISG) {
if (group != "MISG") return AppendResult::GROUP_INVALIDATED;
isIncomplete = false;
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////
std::optional<RunwayStateGroup> RunwayStateGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<RunwayStateGroup> notRecognised;
RunwayStateGroup result;
if (reportPart != ReportPart::METAR) return notRecognised;
if (group == "SNOCLO" || group == "R/SNOCLO")
return RunwayStateGroup(Type::AERODROME_SNOCLO, Runway::makeAllRunways());
static const std::regex rgx("(R\\d\\d[RCL]?)/(?:"
"(SNOCLO)|"
"((\\d\\d)?D)|"
"(?:([0-9/])([0-9/])(\\d\\d|//)|(CLRD))(\\d\\d|//))|");
static const auto matchRunway = 1, matchSnoclo = 2;
static const auto matchClrdAvc = 3, matchFrictionAvc = 4;
static const auto matchDeposits = 5, matchExtent = 6, matchDepth = 7;
static const auto matchClrd = 8, matchFriction = 9;
static const std::string depthRunwayNotOperational = "99";
std::smatch match;
if (!regex_match(group, match, rgx)) return notRecognised;
const auto runway = Runway::fromString(match.str(matchRunway));
if (!runway.has_value()) return notRecognised;
if (match.length(matchSnoclo))
return RunwayStateGroup(Type::RUNWAY_SNOCLO, *runway);
if (match.length(matchClrdAvc)) {
auto fr = SurfaceFriction();
if (match.length(matchFrictionAvc)) {
const auto f = SurfaceFriction::fromString(match.str(matchFrictionAvc));
if (!f.has_value()) return notRecognised;
fr = *f;
}
return RunwayStateGroup(Type::RUNWAY_CLRD, *runway, fr);
}
const auto friction = SurfaceFriction::fromString(match.str(matchFriction));
if (!friction.has_value()) return notRecognised;
if (match.length(matchClrd))
return RunwayStateGroup(Type::RUNWAY_CLRD, *runway, *friction);
const auto deposits = depositsFromString(match.str(matchDeposits));
if (!deposits.has_value()) return notRecognised;
const auto extent = extentFromString(match.str(matchExtent));
if (!extent.has_value()) return notRecognised;
const auto depth = Precipitation::fromRunwayDeposits(match.str(matchDepth));
if (!depth.has_value()) return notRecognised;
result.tp = Type::RUNWAY_STATE;
if (match.str(matchDepth) == depthRunwayNotOperational) {
result.tp = Type::RUNWAY_NOT_OPERATIONAL;
}
result.rw = runway.value();
result.dp = deposits.value();
result.ext = extent.value();
result.dDepth = depth.value();
result.sf = friction.value();
return result;
}
AppendResult RunwayStateGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
std::optional<RunwayStateGroup::Deposits> RunwayStateGroup::depositsFromString(
const std::string & s)
{
std::optional<Deposits> error;
if (s.length() != 1) return error;
switch (s[0]) {
case '0': return Deposits::CLEAR_AND_DRY;
case '1': return Deposits::DAMP;
case '2': return Deposits::WET_AND_WATER_PATCHES;
case '3': return Deposits::RIME_AND_FROST_COVERED;
case '4': return Deposits::DRY_SNOW;
case '5': return Deposits::WET_SNOW;
case '6': return Deposits::SLUSH;
case '7': return Deposits::ICE;
case '8': return Deposits::COMPACTED_OR_ROLLED_SNOW;
case '9': return Deposits::FROZEN_RUTS_OR_RIDGES;
case '/': return Deposits::NOT_REPORTED;
default: return error;
}
}
std::optional<RunwayStateGroup::Extent> RunwayStateGroup::extentFromString(
const std::string & s)
{
std::optional<Extent> error;
if (s.length() != 1) return error;
switch (s[0]) {
case '0': return Extent::NONE;
case '1': return Extent::LESS_THAN_10_PERCENT;
case '2': return Extent::FROM_11_TO_25_PERCENT;
case '3': return Extent::RESERVED_3;
case '4': return Extent::RESERVED_4;
case '5': return Extent::FROM_26_TO_50_PERCENT;
case '6': return Extent::RESERVED_6;
case '7': return Extent::RESERVED_7;
case '8': return Extent::RESERVED_8;
case '9': return Extent::MORE_THAN_51_PERCENT;
case '/': return Extent::NOT_REPORTED;
default: return error;
}
}
///////////////////////////////////////////////////////////////////////////////
std::optional<SeaSurfaceGroup> SeaSurfaceGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::optional<SeaSurfaceGroup> notRecognised;
if (reportPart != ReportPart::METAR) return notRecognised;
static const std::regex rgx ("W(\\d\\d|//)/([HS](?:\\d\\d?\\d?|///|/))");
static const auto matchTemp = 1, matchWaveHeight = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
const auto temp = Temperature::fromString(match.str(matchTemp));
if (!temp.has_value()) return notRecognised;
const auto waveHeight = WaveHeight::fromString(match.str(matchWaveHeight));
if (!waveHeight.has_value()) return notRecognised;
SeaSurfaceGroup result;
result.t = *temp;
result.wh = *waveHeight;
return result;
}
AppendResult SeaSurfaceGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<MinMaxTemperatureGroup> MinMaxTemperatureGroup::parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
if (reportPart == ReportPart::TAF) return fromForecast(group);
if (reportPart == ReportPart::RMK) {
if (const auto h6 = from6hourly(group); h6.has_value()) return h6;
if (const auto h24 = from24hourly(group); h24.has_value()) return h24;
}
return std::optional<MinMaxTemperatureGroup>();
}
AppendResult MinMaxTemperatureGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportPart; (void)reportMetadata;
switch (type()) {
case Type::OBSERVED_6_HOURLY: return append6hourly(group);
case Type::OBSERVED_24_HOURLY: return AppendResult::NOT_APPENDED;
case Type::FORECAST: return appendForecast(group);
}
}
std::optional<MinMaxTemperatureGroup> MinMaxTemperatureGroup::from6hourly(
const std::string & group)
{
std::optional<MinMaxTemperatureGroup> notRecognised;
static const std::regex rgx("([12])([01]\\d\\d\\d|////)");
static const auto matchType = 1, matchValue = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
MinMaxTemperatureGroup result;
result.t = Type::OBSERVED_6_HOURLY;
if (match.str(matchValue) == "////") return result;
const auto temp = Temperature::fromRemarkString(match.str(matchValue));
if (!temp.has_value()) return notRecognised;
const auto typeStr = match.str(matchType);
if (typeStr == "1") { result.maxTemp = *temp; }
if (typeStr == "2") { result.minTemp = *temp; }
return result;
}
std::optional<MinMaxTemperatureGroup> MinMaxTemperatureGroup::from24hourly(
const std::string & group)
{
std::optional<MinMaxTemperatureGroup> notRecognised;
static const std::regex rgx("4([01]\\d\\d\\d)([01]\\d\\d\\d)");
static const auto matchMax = 1, matchMin = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
const auto max = Temperature::fromRemarkString(match.str(matchMax));
if (!max.has_value()) return notRecognised;
const auto min = Temperature::fromRemarkString(match.str(matchMin));
if (!min.has_value()) return notRecognised;
MinMaxTemperatureGroup result;
result.t = Type::OBSERVED_24_HOURLY;
result.minTemp = *min;
result.maxTemp = *max;
return result;
}
std::optional<MinMaxTemperatureGroup> MinMaxTemperatureGroup::fromForecast(
const std::string & group)
{
static const std::optional<MinMaxTemperatureGroup> notRecognised;
static const std::regex rgx ("T([XN])?(M?\\d\\d)/(\\d\\d\\d\\d)Z");
static const auto matchPoint = 1, matchTemperature = 2, matchTime = 3;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
auto temp = Temperature::fromString(match.str(matchTemperature));
if (!temp.has_value()) return notRecognised;
auto time = MetafTime::fromStringDDHH(match.str(matchTime));
if (!time.has_value()) return notRecognised;
MinMaxTemperatureGroup result;
result.t = Type::FORECAST;
if (match.str(matchPoint) == "N") {
result.minTemp = *temp;
result.minTime = time;
}
if (match.str(matchPoint) == "X") {
result.maxTemp = *temp;
result.maxTime = time;
}
if (!match.length(matchPoint)) {
result.minTemp = *temp;
result.minTime = time;
result.maxTemp = *temp;
result.maxTime = time;
result.isIncomplete = true;
}
return result;
}
AppendResult MinMaxTemperatureGroup::append6hourly(const std::string & group) {
static const auto error = AppendResult::NOT_APPENDED;
if (minTemp.isReported() && maxTemp.isReported()) return error;
const auto nextGroup = from6hourly(group);
if (!nextGroup.has_value()) return error;
if (minTemp.isReported() && nextGroup->minTemp.isReported()) return error;
if (maxTemp.isReported() && nextGroup->maxTemp.isReported()) return error;
if (!minTemp.isReported() && nextGroup->minTemp.isReported()) minTemp = nextGroup->minTemp;
if (!maxTemp.isReported() && nextGroup->maxTemp.isReported()) maxTemp = nextGroup->maxTemp;
return AppendResult::APPENDED;
}
AppendResult MinMaxTemperatureGroup::appendForecast(const std::string & group) {
static const auto error = AppendResult::NOT_APPENDED;
if (minTemp.isReported() && maxTemp.isReported() && !isIncomplete) return error;
const auto nextGroup = fromForecast(group);
if (!nextGroup.has_value()) return error;
if (isIncomplete != nextGroup->isIncomplete) return error;
if (!isIncomplete) {
// Minimum or maximum temperature point specified explicitly
// Get minimum either from *this or from nextGroup, and maximum from other group
// Make sure appending two minimums or two maximums will result in error
if (minTemp.isReported() && nextGroup->minTemp.isReported()) return error;
if (maxTemp.isReported() && nextGroup->maxTemp.isReported()) return error;
if (!minTemp.isReported() && nextGroup->minTemp.isReported()) {
minTemp = nextGroup->minTemp;
minTime = nextGroup->minTime;
}
if (!maxTemp.isReported() && nextGroup->maxTemp.isReported()) {
maxTemp = nextGroup->maxTemp;
maxTime = nextGroup->maxTime;
}
if (!minTemp.isReported() || !maxTemp.isReported()) return error;
} else {
maxTemp = nextGroup->maxTemp;
maxTime = nextGroup->maxTime;
if ((!minTemp.isFreezing() && maxTemp.isFreezing()) ||
*minTemp.temperature() > *maxTemp.temperature())
{
std::swap(minTemp, maxTemp);
std::swap(minTime, maxTime);
}
isIncomplete = false;
}
return AppendResult::APPENDED;
}
bool MinMaxTemperatureGroup::isValid() const {
if (isIncomplete) return false;
if (minimum().isReported() &&
maximum().isReported() &&
!minimum().isFreezing() &&
maximum().isFreezing()) return false;
if (!minimumTime().value_or(MetafTime()).isValid()) return false;
if (!maximumTime().value_or(MetafTime()).isValid()) return false;
return ((minimum().temperature().value_or(-100) < maximum().temperature().value_or(100)));
}
///////////////////////////////////////////////////////////////////////////////
std::optional<PrecipitationGroup> PrecipitationGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
std::optional<PrecipitationGroup> notRecognised;
static const std::regex rgx(
"([P67])(\\d\\d\\d\\d|////)|(4/|93[13]|I[136]|PP)(\\d\\d\\d|///)");
static const auto matchType1 = 1, matchType2 = 3;
static const auto matchValue1 = 2, matchValue2 = 4;
static const std::regex rfRgx (
"RF(\\d\\d\\.\\d|//\\./)/(\\d\\d\\d\\.\\d|///\\./)");
static const auto rfMatchLast10Minutes = 1, rfMatchSince9AM = 2;
std::smatch match;
PrecipitationGroup result;
if (reportPart == ReportPart::METAR) {
if (!std::regex_match(group, match, rfRgx)) return notRecognised;
const auto last10min =
Precipitation::fromRainfallString(match.str(rfMatchLast10Minutes));
if (!last10min.has_value()) return notRecognised;
const auto since9AM =
Precipitation::fromRainfallString(match.str(rfMatchSince9AM));
if (!since9AM.has_value()) return notRecognised;
result.precType = Type::RAINFALL_9AM_10MIN;
result.precAmount = *since9AM;
result.precChange = *last10min;
return result;
}
if (reportPart != ReportPart::RMK) return notRecognised;
if (group == "PNO") return PrecipitationGroup(Type::PNO);
if (group == "FZRANO") return PrecipitationGroup(Type::FZRANO);
if (group == "ICG") return PrecipitationGroup(Type::ICG_MISG, true);
if (group == "PCPN") return PrecipitationGroup(Type::PCPN_MISG, true);
if (group == "SNINCR") return PrecipitationGroup(Type::SNOW_INCREASING_RAPIDLY);
if (!std::regex_match(group, match, rgx)) return notRecognised;
// assuming only one pair matchType and matchValue will be non-empty
std::string typeStr = match.str(matchType1) + match.str(matchType2);
std::string valueStr = match.str(matchValue1) + match.str(matchValue2);
const bool is3hourly =
reportMetadata.reportTime.has_value() ?
reportMetadata.reportTime->is3hourlyReportTime() :
false;
const bool is6hourly =
reportMetadata.reportTime.has_value() ?
reportMetadata.reportTime->is6hourlyReportTime() :
false;
if (typeStr == "P") result.precType = Type::TOTAL_PRECIPITATION_HOURLY;
if (typeStr == "4/") result.precType = Type::SNOW_DEPTH_ON_GROUND;
if (typeStr == "6") {
result.precType = Type::FROZEN_PRECIP_3_OR_6_HOURLY;
if (is3hourly) result.precType = Type::FROZEN_PRECIP_3_HOURLY;
if (is6hourly) result.precType = Type::FROZEN_PRECIP_6_HOURLY;
}
if (typeStr == "7") result.precType = Type::FROZEN_PRECIP_24_HOURLY;
if (typeStr == "931") result.precType = Type::SNOW_6_HOURLY;
if (typeStr == "933") result.precType = Type::WATER_EQUIV_OF_SNOW_ON_GROUND;
if (typeStr == "I1") result.precType = Type::ICE_ACCRETION_FOR_LAST_HOUR;
if (typeStr == "I3") result.precType = Type::ICE_ACCRETION_FOR_LAST_3_HOURS;
if (typeStr == "I6") result.precType = Type::ICE_ACCRETION_FOR_LAST_6_HOURS;
if (typeStr == "PP") result.precType = Type::PRECIPITATION_ACCUMULATION_SINCE_LAST_REPORT;
const auto amount = Precipitation::fromRemarkString(valueStr,
factorFromType(result.precType),
unitFromType(result.precType),
true);
if (!amount.has_value()) return notRecognised;
result.precAmount = *amount;
return result;
}
AppendResult PrecipitationGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)reportPart;
if (type() == Type::PCPN_MISG || type() == Type::ICG_MISG) {
if (!isIncomplete) return AppendResult::NOT_APPENDED;
if (group != "MISG") return AppendResult::GROUP_INVALIDATED;
isIncomplete = false;
return AppendResult::APPENDED;
}
if (type() != Type::SNOW_INCREASING_RAPIDLY) return AppendResult::NOT_APPENDED;
if (total().isReported() || recent().isReported())
return AppendResult::NOT_APPENDED;
const auto precip = Precipitation::fromSnincrString(group);
if (!precip.has_value()) return AppendResult::NOT_APPENDED;
precChange = std::get<0>(*precip);
precAmount = std::get<1>(*precip);
return AppendResult::APPENDED;
}
Precipitation::Unit PrecipitationGroup::unitFromType(Type type) {
switch(type) {
case Type::PRECIPITATION_ACCUMULATION_SINCE_LAST_REPORT:
return Precipitation::Unit::MM;
default:
return Precipitation::Unit::INCHES;
}
}
float PrecipitationGroup::factorFromType(Type type) {
switch(type) {
case Type::WATER_EQUIV_OF_SNOW_ON_GROUND:
case Type::SNOW_6_HOURLY:
case Type::PRECIPITATION_ACCUMULATION_SINCE_LAST_REPORT:
return 0.1;
case Type::TOTAL_PRECIPITATION_HOURLY:
case Type::FROZEN_PRECIP_3_OR_6_HOURLY:
case Type::FROZEN_PRECIP_3_HOURLY:
case Type::FROZEN_PRECIP_6_HOURLY:
case Type::FROZEN_PRECIP_24_HOURLY:
case Type::ICE_ACCRETION_FOR_LAST_HOUR:
case Type::ICE_ACCRETION_FOR_LAST_3_HOURS:
case Type::ICE_ACCRETION_FOR_LAST_6_HOURS:
return 0.01;
default:
return 1;
}
}
///////////////////////////////////////////////////////////////////////////////
std::optional<LayerForecastGroup::Type> LayerForecastGroup::typeFromStr(
const std::string & s)
{
if (s == "60") return Type::ICING_TRACE_OR_NONE;
if (s == "61") return Type::ICING_LIGHT_MIXED;
if (s == "62") return Type::ICING_LIGHT_RIME_IN_CLOUD;
if (s == "63") return Type::ICING_LIGHT_CLEAR_IN_PRECIPITATION;
if (s == "64") return Type::ICING_MODERATE_MIXED;
if (s == "65") return Type::ICING_MODERATE_RIME_IN_CLOUD;
if (s == "66") return Type::ICING_MODERATE_CLEAR_IN_PRECIPITATION;
if (s == "67") return Type::ICING_SEVERE_MIXED;
if (s == "68") return Type::ICING_SEVERE_RIME_IN_CLOUD;
if (s == "69") return Type::ICING_SEVERE_CLEAR_IN_PRECIPITATION;
if (s == "50") return Type::TURBULENCE_NONE;
if (s == "51") return Type::TURBULENCE_LIGHT;
if (s == "52") return Type::TURBULENCE_MODERATE_IN_CLEAR_AIR_OCCASIONAL;
if (s == "53") return Type::TURBULENCE_MODERATE_IN_CLEAR_AIR_FREQUENT;
if (s == "54") return Type::TURBULENCE_MODERATE_IN_CLOUD_OCCASIONAL;
if (s == "55") return Type::TURBULENCE_MODERATE_IN_CLOUD_FREQUENT;
if (s == "56") return Type::TURBULENCE_SEVERE_IN_CLEAR_AIR_OCCASIONAL;
if (s == "57") return Type::TURBULENCE_SEVERE_IN_CLEAR_AIR_FREQUENT;
if (s == "58") return Type::TURBULENCE_SEVERE_IN_CLOUD_OCCASIONAL;
if (s == "59") return Type::TURBULENCE_SEVERE_IN_CLOUD_FREQUENT;
if (s == "5X") return Type::TURBULENCE_EXTREME;
return std::optional<Type>();
}
std::optional<LayerForecastGroup> LayerForecastGroup::parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
std::optional<LayerForecastGroup> notRecognised;
static const std::regex rgx("([65][\\dX])(\\d\\d\\d\\d|////)");
static const auto matchType = 1, matchHeight = 2;
if (reportPart != ReportPart::TAF) return notRecognised;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
const auto type = typeFromStr(match.str(matchType));
if (!type.has_value()) return notRecognised;
const auto heights = Distance::fromLayerString(match.str(matchHeight));
if (!heights.has_value() && match.str(matchHeight) != "////") return notRecognised;
LayerForecastGroup result;
result.layerType = *type;
if (match.str(matchHeight) != "////") {
result.layerBaseHeight = std::get<0>(*heights);
result.layerTopHeight = std::get<1>(*heights);
}
return result;
}
AppendResult LayerForecastGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////////
PressureTendencyGroup::Trend PressureTendencyGroup::trend(Type type) {
switch(type) {
case Type::INCREASING_MORE_SLOWLY:
case Type::INCREASING:
case Type::INCREASING_MORE_RAPIDLY:
return Trend::HIGHER;
case Type::INCREASING_THEN_DECREASING:
return Trend::HIGHER_OR_SAME;
case Type::STEADY:
return Trend::SAME;
case Type::DECREASING_THEN_INCREASING:
return Trend::LOWER_OR_SAME;
case Type::DECREASING_MORE_SLOWLY:
case Type::DECREASING:
case Type::DECREASING_MORE_RAPIDLY:
return Trend::LOWER;
case Type::NOT_REPORTED:
case Type::RISING_RAPIDLY:
case Type::FALLING_RAPIDLY:
return Trend::NOT_REPORTED;
}
}
std::optional<PressureTendencyGroup::Type> PressureTendencyGroup::typeFromChar(
char type)
{
switch (type) {
case '0': return Type::INCREASING_THEN_DECREASING;
case '1': return Type::INCREASING_MORE_SLOWLY;
case '2': return Type::INCREASING;
case '3': return Type::INCREASING_MORE_RAPIDLY;
case '4': return Type::STEADY;
case '5': return Type::DECREASING_THEN_INCREASING;
case '6': return Type::DECREASING_MORE_SLOWLY;
case '7': return Type::DECREASING;
case '8': return Type::DECREASING_MORE_RAPIDLY;
case '/': return Type::NOT_REPORTED;
default: return std::optional<Type>();
}
}
std::optional<PressureTendencyGroup> PressureTendencyGroup::parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
std::optional<PressureTendencyGroup> notRecognised;
if (reportPart != ReportPart::RMK) return notRecognised;
if (group == "PRESRR") {
PressureTendencyGroup result;
result.tendencyType = Type::RISING_RAPIDLY;
return result;
}
if (group == "PRESFR") {
PressureTendencyGroup result;
result.tendencyType = Type::FALLING_RAPIDLY;
return result;
}
static const std::regex rgx("5([\\d/])(\\d\\d\\d|///)");
static const auto matchType = 1, matchPressure = 2;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
const auto type = typeFromChar(match.str(matchType)[0]);
if (!type.has_value()) return notRecognised;
const auto pressure = Pressure::fromTendencyString(match.str(matchPressure));
if (!pressure.has_value()) return notRecognised;
PressureTendencyGroup result;
result.tendencyType = *type;
result.pressureDifference = *pressure;
return result;
}
AppendResult PressureTendencyGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
///////////////////////////////////////////////////////////////////////////////
std::vector<CloudType> CloudTypesGroup::cloudTypes() const {
std::vector<CloudType> result;
for (auto i=0u; i < cldTpSize; i++)
result.push_back(cldTp[i]);
return result;
}
std::optional<CloudTypesGroup> CloudTypesGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
std::optional<CloudTypesGroup> notRecognised;
//"(CB|TCU|CU|CF|SC|NS|ST|SF|AS|AC|ACC|CI|CS|CC|BLSN|BLDU|BLSA|IC|)(\\d)"
static const std::regex matchRgx("(?:(?:[A-Z]{2,4})[\\d])+");
static const std::regex searchRgx("[A-Z]{2,4}[\\d]");
if (reportPart != ReportPart::RMK) return notRecognised;
std::smatch match;
CloudTypesGroup result;
if (const auto ctp = CloudType::fromString(group); ctp.has_value()) {
result.cldTp[0] = *ctp;
result.cldTpSize = 1;
return result;
}
if (!std::regex_match(group, match, matchRgx)) return notRecognised;
auto iter = std::sregex_iterator(group.begin(), group.end(), searchRgx);
while (iter != std::sregex_iterator()) {
if (result.cldTpSize >= result.cldTpMaxSize) return result;
match = *iter++;
const auto ctp = CloudType::fromString(match.str(0));
if (!ctp.has_value()) return notRecognised;
result.cldTp[result.cldTpSize++] = *ctp;
}
return result;
}
AppendResult CloudTypesGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
if (cldTpSize >= cldTpMaxSize) return AppendResult::NOT_APPENDED;
if (!cldTp[cldTpSize - 1].height().isReported()) return AppendResult::NOT_APPENDED;
const auto ctp = CloudType::fromString(group);
if (!ctp.has_value()) return AppendResult::NOT_APPENDED;
if (!ctp->height().isReported()) return AppendResult::NOT_APPENDED;
cldTp[cldTpSize++] = *ctp;
return AppendResult::APPENDED;
}
bool CloudTypesGroup::isValid() const {
for (auto i=0u; i < cldTpSize; i++)
if (!cldTp[i].isValid()) return false;
return true;
}
///////////////////////////////////////////////////////////////////////////////
bool LowMidHighCloudGroup::isValid() const {
if (lowLayer() == LowLayer::NOT_OBSERVABLE &&
midLayer() != MidLayer::NOT_OBSERVABLE) return false;
if (midLayer() == MidLayer::NOT_OBSERVABLE &&
highLayer() != HighLayer::NOT_OBSERVABLE) return false;
return true;
}
std::optional<LowMidHighCloudGroup> LowMidHighCloudGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
std::optional<LowMidHighCloudGroup> notRecognised;
static const std::regex rgx("8/([0-9/])([0-9/])([0-9/])");
static const auto matchLowLayer = 1, matchMidLayer = 2, matchHighLayer = 3;
if (reportPart != ReportPart::RMK) return notRecognised;
std::smatch match;
if (!std::regex_match(group, match, rgx)) return notRecognised;
const auto lowLayer = lowLayerFromChar(match.str(matchLowLayer)[0]);
const auto midLayer = midLayerFromChar(match.str(matchMidLayer)[0]);
const auto highLayer = highLayerFromChar(match.str(matchHighLayer)[0]);
LowMidHighCloudGroup result;
result.cloudLowLayer = lowLayer;
result.cloudMidLayer = midLayer;
result.cloudHighLayer = highLayer;
return result;
}
AppendResult LowMidHighCloudGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)group; (void)reportPart;
return AppendResult::NOT_APPENDED;
}
LowMidHighCloudGroup::LowLayer LowMidHighCloudGroup::lowLayerFromChar(char c) {
switch (c) {
case '0': return LowLayer::NONE;
case '1': return LowLayer::CU_HU_CU_FR;
case '2': return LowLayer::CU_MED_CU_CON;
case '3': return LowLayer::CB_CAL;
case '4': return LowLayer::SC_CUGEN;
case '5': return LowLayer::SC_NON_CUGEN;
case '6': return LowLayer::ST_NEB_ST_FR;
case '7': return LowLayer::ST_FR_CU_FR_PANNUS;
case '8': return LowLayer::CU_SC_NON_CUGEN_DIFFERENT_LEVELS;
case '9': return LowLayer::CB_CAP;
default: return LowLayer::NOT_OBSERVABLE;
}
}
LowMidHighCloudGroup::MidLayer LowMidHighCloudGroup::midLayerFromChar(char c) {
switch (c) {
case '0': return MidLayer::NONE;
case '1': return MidLayer::AS_TR;
case '2': return MidLayer::AS_OP_NS;
case '3': return MidLayer::AC_TR;
case '4': return MidLayer::AC_TR_LEN_PATCHES;
case '5': return MidLayer::AC_TR_AC_OP_SPREADING;
case '6': return MidLayer::AC_CUGEN_AC_CBGEN;
case '7': return MidLayer::AC_DU_AC_OP_AC_WITH_AS_OR_NS;
case '8': return MidLayer::AC_CAS_AC_FLO;
case '9': return MidLayer::AC_OF_CHAOTIC_SKY;
default: return MidLayer::NOT_OBSERVABLE;
}
}
LowMidHighCloudGroup::HighLayer LowMidHighCloudGroup::highLayerFromChar(char c) {
switch (c) {
case '0': return HighLayer::NONE;
case '1': return HighLayer::CI_FIB_CI_UNC;
case '2': return HighLayer::CI_SPI_CI_CAS_CI_FLO;
case '3': return HighLayer::CI_SPI_CBGEN;
case '4': return HighLayer::CI_FIB_CI_UNC_SPREADING;
case '5': return HighLayer::CI_CS_LOW_ABOVE_HORIZON;
case '6': return HighLayer::CI_CS_HIGH_ABOVE_HORIZON;
case '7': return HighLayer::CS_NEB_CS_FIB_COVERING_ENTIRE_SKY;
case '8': return HighLayer::CS;
case '9': return HighLayer::CC;
default: return HighLayer::NOT_OBSERVABLE;
}
}
///////////////////////////////////////////////////////////////////////////////
std::optional<LightningGroup> LightningGroup::parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void) reportMetadata;
if (reportPart != ReportPart::RMK) return std::optional<LightningGroup>();
if (group == "OCNL") return LightningGroup(Frequency::OCCASIONAL);
if (group == "FRQ") return LightningGroup(Frequency::FREQUENT);
if (group == "CONS") return LightningGroup(Frequency::CONSTANT);
return fromLtgGroup(group);
}
AppendResult LightningGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportPart; (void)reportMetadata;
if (incomplete) {
//Frequency was specified, now expecting LTG group
if (const auto ltg = fromLtgGroup(group); ltg.has_value())
{
Frequency f = freq;
*this = std::move(*ltg);
freq = f;
return AppendResult::APPENDED;
}
return AppendResult::GROUP_INVALIDATED;
}
if (!isOmittedDir2()) return AppendResult::NOT_APPENDED;
if (!isOmittedDir1()) {
// First direction sector is already appended, try to append second one
if (group == "AND") return AppendResult::APPENDED;
if (const auto dir = Direction::fromCardinalString(group, true); dir.has_value()) {
//Single direction is specified
dir2from = *dir;
return AppendResult::APPENDED;
}
if (const auto dirSec = Direction::fromSectorString(group); dirSec.has_value())
{
//Direction sector is specified
dir2from = std::get<0>(*dirSec);
dir2to = std::get<1>(*dirSec);
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
// No direction sector was previously appended to group
if (group == "DSNT") { dist = Distance::makeDistant(); return AppendResult::APPENDED; }
if (group == "VC") { dist = Distance::makeVicinity(); return AppendResult::APPENDED; }
if (const auto dir = Direction::fromCardinalString(group, true); dir.has_value()) {
//Single direction is specified
dir1from = *dir;
return AppendResult::APPENDED;
}
if (const auto dirSec = Direction::fromSectorString(group); dirSec.has_value())
{
dir1from = std::get<0>(*dirSec);
dir1to = std::get<1>(*dirSec);
return AppendResult::APPENDED;
}
return AppendResult::NOT_APPENDED;
}
std::optional<LightningGroup> LightningGroup::fromLtgGroup(const std::string & group) {
std::optional<LightningGroup> notRecognised;
static const auto ltgLen = 3u; // length of string LTG
static const char ltg[ltgLen + 1] = "LTG";
LightningGroup result;
if (group == ltg) return (result);
if (group.length() < ltgLen) return notRecognised;
if (group.substr(0, ltgLen) != ltg) return notRecognised;
auto currPos = ltgLen;
static const auto typeLen = 2;
static const auto maxLightningTypeCount =
6; // arbitrary number greater than 4; well formed group can have max 4 types
auto lightningTypeCount = 0;
while(currPos < group.length() && lightningTypeCount < maxLightningTypeCount) {
const auto currType = group.substr(currPos, typeLen);
currPos += typeLen;
lightningTypeCount++;
if (currType == "IC") { result.typeInCloud = true; continue; }
if (currType == "CC") { result.typeCloudCloud = true; continue; }
if (currType == "CG") { result.typeCloudGround = true; continue; }
if (currType == "CA") { result.typeCloudAir = true; continue; }
result.typeUnknown = true;
}
return result;
}
std::vector<Direction> LightningGroup::directions() const {
// The result vector is max 10 elements possible, typically up to
// 5 elements which does not justify using std::set and std::find
auto result = Direction::sectorCardinalDirToVector(
dir1from.value_or(Direction()),
dir1to.value_or(Direction()));
const auto result2 = Direction::sectorCardinalDirToVector(
dir2from.value_or(Direction()),
dir2to.value_or(Direction()));
for (const auto r2 : result2) {
// Check if r2 is already present in result
bool r2_alreadyPresent = false;
for (const auto r : result)
if (r.cardinal() == r2.cardinal()) { r2_alreadyPresent = true; break;}
if (!r2_alreadyPresent) result.push_back(r2);
}
return result;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<VicinityGroup> VicinityGroup::parse(
const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void) reportMetadata;
std::optional<VicinityGroup> notRecognised;
if (reportPart != ReportPart::RMK) return notRecognised;
if (group == "TS") return VicinityGroup(Type::THUNDERSTORM);
if (group == "CB") return VicinityGroup(Type::CUMULONIMBUS);
if (group == "CBMAM") return VicinityGroup(Type::CUMULONIMBUS_MAMMATUS);
if (group == "ACC") return VicinityGroup(Type::ALTOCUMULUS_CASTELLANUS);
if (group == "TCU") return VicinityGroup(Type::TOWERING_CUMULUS);
if (group == "SCSL") return VicinityGroup(Type::STRATOCUMULUS_STANDING_LENTICULAR);
if (group == "ACSL") return VicinityGroup(Type::ALTOCUMULUS_STANDING_LENTICULAR);
if (group == "CCSL") return VicinityGroup(Type::CIRROCUMULUS_STANDING_LENTICULAR);
if (group == "ROTOR") return VicinityGroup(Type::ROTOR_CLOUD);
if (group == "VIRGA") return VicinityGroup(Type::VIRGA);
if (group == "VCSH") return VicinityGroup(Type::PRECIPITATION_IN_VICINITY);
if (group == "FOG" || group == "FG") return VicinityGroup(Type::FOG);
if (group == "HAZE" || group == "HZ") return VicinityGroup(Type::HAZE);
if (group == "SMOKE" || group == "FU") return VicinityGroup(Type::SMOKE);
if (group == "BLSN") return VicinityGroup(Type::BLOWING_SNOW);
if (group == "BLDU") return VicinityGroup(Type::BLOWING_DUST);
if (group == "BLSA") return VicinityGroup(Type::BLOWING_SAND);
if (group == "MIFG") return VicinityGroup(Type::FOG_SHALLOW);
if (group == "BCFG") return VicinityGroup(Type::FOG_PATCHES);
return notRecognised;
}
AppendResult VicinityGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportPart; (void)reportMetadata;
switch(incompleteType) {
case IncompleteType::NONE:
//Group is complete, nothing more to append
return AppendResult::NOT_APPENDED;
case IncompleteType::EXPECT_CLD:
if (group == "CLD") return expectNext(IncompleteType::EXPECT_DIST_DIR1);
return AppendResult::GROUP_INVALIDATED;
case IncompleteType::EXPECT_DIST_DIR1:
if (appendDistance(group)) return expectNext(IncompleteType::EXPECT_DIR1);
if (appendDir1(group)) return expectNext(IncompleteType::EXPECT_DIR2_MOV);
return AppendResult::GROUP_INVALIDATED;
case IncompleteType::EXPECT_DIR1:
if (appendDir1(group)) return expectNext(IncompleteType::EXPECT_DIR2_MOV);
return rejectGroup();
case IncompleteType::EXPECT_DIR2_MOV:
if (group == "MOV") return expectNext(IncompleteType::EXPECT_MOVDIR);
if (group == "AND") return expectNext(IncompleteType::EXPECT_DIR2);
if (appendDir2(group)) return expectNext(IncompleteType::EXPECT_MOV);
return rejectGroup();
case IncompleteType::EXPECT_DIR2:
if (appendDir2(group)) return expectNext(IncompleteType::EXPECT_MOV);
return AppendResult::GROUP_INVALIDATED;
case IncompleteType::EXPECT_MOV:
if (group == "MOV") return expectNext(IncompleteType::EXPECT_MOVDIR);
return rejectGroup();
case IncompleteType::EXPECT_MOVDIR:
if (const auto dir = Direction::fromCardinalString(group, false, true);
dir.has_value())
{
movDir = *dir;
return finalise();
}
return AppendResult::GROUP_INVALIDATED;
}
}
bool VicinityGroup::appendDir1(const std::string & str) {
if (const auto dir = Direction::fromCardinalString(str, true); dir.has_value()) {
//Single direction is specified
dir1from = *dir;
return true;
}
if (const auto dirSec = Direction::fromSectorString(str); dirSec.has_value())
{
dir1from = std::get<0>(*dirSec);
dir1to = std::get<1>(*dirSec);
return true;
}
return false;
}
bool VicinityGroup::appendDir2(const std::string & str) {
if (const auto dir = Direction::fromCardinalString(str, true); dir.has_value()) {
//Single direction is specified
dir2from = *dir;
return true;
}
if (const auto dirSec = Direction::fromSectorString(str); dirSec.has_value())
{
dir2from = std::get<0>(*dirSec);
dir2to = std::get<1>(*dirSec);
return true;
}
return false;
}
bool VicinityGroup::appendDistance(const std::string & str) {
if (str == "DSNT") { dist = Distance::makeDistant(); return true; }
if (str == "VC") { dist = Distance::makeVicinity(); return true; }
const auto d = Distance::fromKmString(str);
if (!d.has_value()) return false;
dist = *d;
return true;
}
std::vector<Direction> VicinityGroup::directions() const {
// Copy of LightningGroup::directions
auto result = Direction::sectorCardinalDirToVector(
dir1from.value_or(Direction()),
dir1to.value_or(Direction()));
const auto result2 = Direction::sectorCardinalDirToVector(
dir2from.value_or(Direction()),
dir2to.value_or(Direction()));
for (const auto r2 : result2) {
// Check if r2 is already present in result
bool r2_alreadyPresent = false;
for (const auto r : result)
if (r.cardinal() == r2.cardinal()) { r2_alreadyPresent = true; break;}
if (!r2_alreadyPresent) result.push_back(r2);
}
return result;
}
///////////////////////////////////////////////////////////////////////////////
std::optional<MiscGroup> MiscGroup::parse(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata;
static const std::regex rgxSunshineDuration("98(\\d\\d\\d)");
static const std::regex rgxCorrectionObservation("CC([A-Z])");
static const auto matchValue = 1;
static const std::regex rgxIssuerId("F([NS])(\\d\\d\\d\\d\\d)");
static const auto matchIssuerStation = 1, matchIssuerId = 2;
std::smatch match;
MiscGroup result;
if (reportPart == ReportPart::METAR || reportPart == ReportPart::RMK) {
if (const auto c = parseColourCode(group); c.has_value()) {
result.groupType = *c;
return result;
}
}
if (reportPart == ReportPart::TAF) {
if (std::regex_match(group, match, rgxIssuerId)) {
result.groupType = Type::ISSUER_ID_FS;
if (match.str(matchIssuerStation) == "N") result.groupType = Type::ISSUER_ID_FN;
result.groupData = std::stoi(match.str(matchIssuerId));
return result;
}
}
if (reportPart == ReportPart::METAR) {
if (std::regex_match(group, match, rgxCorrectionObservation)) {
result.groupType = Type::CORRECTED_WEATHER_OBSERVATION;
result.groupData = match.str(matchValue)[0] - 'A' + 1;
return result;
}
}
if (reportPart == ReportPart::RMK) {
if (group == "GR") {
result.groupType = Type::HAILSTONE_SIZE;
result.incompleteText = IncompleteText::GR;
return result;
}
if (group == "DENSITY") {
result.groupType = Type::DENSITY_ALTITUDE;
result.incompleteText = IncompleteText::DENSITY;
return result;
}
if (std::regex_match(group, match, rgxSunshineDuration)) {
result.groupType = Type::SUNSHINE_DURATION_MINUTES;
result.groupData = std::stoi(match.str(matchValue));
return result;
}
if (group == "FROIN") {
result.groupType = Type::FROIN;
return result;
}
}
return std::optional<MiscGroup>();
}
AppendResult MiscGroup::append(const std::string & group,
ReportPart reportPart,
const ReportMetadata & reportMetadata)
{
(void)reportMetadata; (void)reportPart;
switch(incompleteText){
case IncompleteText::NONE:
return AppendResult::NOT_APPENDED;
case IncompleteText::DENSITY:
if (group == "ALT") {
incompleteText = IncompleteText::DENSITY_ALT;
return AppendResult::APPENDED;
}
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::DENSITY_ALT:
if (group == "MISG") {
incompleteText = IncompleteText::NONE;
return AppendResult::APPENDED;
}
if (appendDensityAltitude(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::GR:
if (group.length() == 1 && group[0] >= '1' && group[0] <= '9') {
groupData = group[0] - '0';
incompleteText = IncompleteText::GR_INT;
return AppendResult::APPENDED;
}
if (appendHailstoneFraction(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
case IncompleteText::GR_INT:
if (appendHailstoneFraction(group)) return AppendResult::APPENDED;
return AppendResult::GROUP_INVALIDATED;
}
}
std::optional<MiscGroup::Type> MiscGroup::parseColourCode(const std::string & group) {
if (group == "BLU+") return Type::COLOUR_CODE_BLUE_PLUS;
if (group == "BLU") return Type::COLOUR_CODE_BLUE;
if (group == "WHT") return Type::COLOUR_CODE_WHITE;
if (group == "GRN") return Type::COLOUR_CODE_GREEN;
if (group == "YLO") return Type::COLOUR_CODE_YELLOW;
if (group == "YLO1") return Type::COLOUR_CODE_YELLOW1;
if (group == "YLO2") return Type::COLOUR_CODE_YELLOW2;
if (group == "AMB") return Type::COLOUR_CODE_AMBER;
if (group == "RED") return Type::COLOUR_CODE_RED;
if (group == "BLACKBLU+") return Type::COLOUR_CODE_BLACKBLUE_PLUS;
if (group == "BLACKBLU") return Type::COLOUR_CODE_BLACKBLUE;
if (group == "BLACKWHT") return Type::COLOUR_CODE_BLACKWHITE;
if (group == "BLACKGRN") return Type::COLOUR_CODE_BLACKGREEN;
if (group == "BLACKYLO") return Type::COLOUR_CODE_BLACKYELLOW;
if (group == "BLACKYLO1") return Type::COLOUR_CODE_BLACKYELLOW1;
if (group == "BLACKYLO2") return Type::COLOUR_CODE_BLACKYELLOW2;
if (group == "BLACKAMB") return Type::COLOUR_CODE_BLACKAMBER;
if (group == "BLACKRED") return Type::COLOUR_CODE_BLACKRED;
return std::optional<Type>();
}
bool MiscGroup::appendHailstoneFraction(const std::string & group) {
// Fraction specified with increment of 1/4
bool appended = false;
auto value = groupData.value_or(0.0);
if (group == "1/4") { value += 0.25; appended = true; }
if (group == "1/2" || group == "2/4") { value += 0.5; appended = true; }
if (group == "3/4") { value += 0.75; appended = true; }
if (!appended) return false;
groupData = value;
incompleteText = IncompleteText::NONE;
return true;
}
bool MiscGroup::appendDensityAltitude(const std::string & group) {
static const std::string unitStr ("FT");
static const auto unitLen = unitStr.length();
if (group.length() < unitLen + 1) return false; //require at least 1 digit and FT
const auto groupUnitStr = group.substr(group.length() - unitLen);
if (groupUnitStr != unitStr) return false;
const auto val = strToUint(group, 0, group.length() - unitLen);
if (!val.has_value()) return false;
groupData = *val;
incompleteText = IncompleteText::NONE;
return true;
}
bool MiscGroup::isValid() const {
return (incompleteText == IncompleteText::NONE);
}
///////////////////////////////////////////////////////////////////////////////
SyntaxGroup getSyntaxGroup(const Group & group) {
if (auto keywordGroup = std::get_if<KeywordGroup>(&group)) {
switch (keywordGroup->type()) {
case KeywordGroup::Type::METAR: return SyntaxGroup::METAR;
case KeywordGroup::Type::SPECI: return SyntaxGroup::SPECI;
case KeywordGroup::Type::TAF: return SyntaxGroup::TAF;
case KeywordGroup::Type::COR: return SyntaxGroup::COR;
case KeywordGroup::Type::AMD: return SyntaxGroup::AMD;
case KeywordGroup::Type::NIL: return SyntaxGroup::NIL;
case KeywordGroup::Type::CNL: return SyntaxGroup::CNL;
case KeywordGroup::Type::RMK: return SyntaxGroup::RMK;
case KeywordGroup::Type::MAINTENANCE_INDICATOR:
return SyntaxGroup::MAINTENANCE_INDICATOR;
default: return SyntaxGroup::OTHER;
}
}
if (std::get_if<LocationGroup>(&group)) return SyntaxGroup::LOCATION;
if (std::get_if<ReportTimeGroup>(&group)) return SyntaxGroup::REPORT_TIME;
if (auto trendGroup = std::get_if<TrendGroup>(&group)) {
if (trendGroup->isTimeSpanGroup()) return SyntaxGroup::TIME_SPAN;
return SyntaxGroup::OTHER;
}
return SyntaxGroup::OTHER;
}
///////////////////////////////////////////////////////////////////////////////
ParseResult Parser::parse(const std::string & report, size_t groupLimit) {
ReportInput in(report);
bool reportEnd = false;
Status status;
ReportMetadata reportMetadata;
ParseResult result;
size_t groupCount = 0;
//Iterate through report groups separated by delimiters
std::string groupStr;
in >> groupStr;
while (!groupStr.empty() && !reportEnd && !status.isError()) {
Group group;
ReportPart reportPart = status.getReportPart();
if (!appendToLastResultGroup(result, groupStr, reportPart, reportMetadata)) {
// Current group was not appended to last group
do {
// Group may be parsed multiple times because at this point
// parser may not know yet if the report is METAR or TAF
// and reportPart may change based on report type.
reportPart = status.getReportPart();
group = GroupParser::parse(groupStr, reportPart, reportMetadata);
status.transition(getSyntaxGroup(group));
groupCount++;
if (groupCount >= groupLimit) status.setError(ReportError::REPORT_TOO_LARGE);
} while(status.isReparseRequired() && !status.isError());
updateMetadata(group, reportMetadata);
addGroupToResult(result, std::move(group), reportPart, std::move(groupStr));
} else {
// Raw string was appended to the group, just increase group count
groupCount++;
if (groupCount >= groupLimit) status.setError(ReportError::REPORT_TOO_LARGE);
}
in >> groupStr;
}
if (!result.groups.empty()) {
// if last group is incomplete, invalidate it by adding an empty string
appendToLastResultGroup(result, "", status.getReportPart(), reportMetadata);
// but do not save this empty string if the group just rejects it
if (result.groups.back().rawString.empty()) result.groups.pop_back();
}
status.finalTransition();
reportMetadata.type = status.getReportType();
reportMetadata.error = status.getError();
result.reportMetadata = std::move(reportMetadata);
return result;
}
bool Parser::appendToLastResultGroup(ParseResult & result,
const std::string & groupStr,
ReportPart reportPart,
const ReportMetadata & reportMetadata,
bool allowReparse)
{
// Unable to append if this is the first group
if (result.groups.empty()) return false;
// Do not append last group in result is fallback (unknown) group
// Fallback group is for case 'when everything else fails' and must be
// used only if all parse attempts by other groups failed
if (std::holds_alternative<FallbackGroup>(result.groups.back().group)) return false;
GroupInfo & lastGroupInfo = result.groups.back();
Group & lastGroup = lastGroupInfo.group;
const auto appendResult = std::visit(
[&](auto && gr) -> AppendResult {
return gr.append(groupStr, reportPart, reportMetadata);
}, lastGroup);
switch (appendResult) {
case AppendResult::APPENDED:
lastGroupInfo.rawString += groupDelimiterChar;
lastGroupInfo.rawString += groupStr;
return true;
case AppendResult::NOT_APPENDED:
return false;
case AppendResult::GROUP_INVALIDATED:
{
std::string prevStr = std::move(result.groups.back().rawString);
const auto prevRp = result.groups.back().reportPart;
const auto & prevGroup = result.groups.back().group;
if (!allowReparse) {
addGroupToResult(result, FallbackGroup(), prevRp, std::move(prevStr));
return false;
}
const auto reparsed =
GroupParser::reparse(prevStr, prevRp, reportMetadata, prevGroup);
const bool reparsedIsOtherGroup =
!std::holds_alternative<FallbackGroup>(reparsed);
result.groups.pop_back();
addGroupToResult(result, std::move(reparsed), prevRp, std::move(prevStr));
if (!reparsedIsOtherGroup) return false;
return appendToLastResultGroup(result, groupStr, reportPart, reportMetadata, false);
}
}
}
void Parser::addGroupToResult(ParseResult & result,
Group group,
ReportPart reportPart,
std::string groupString)
{
if (!result.groups.empty() && std::holds_alternative<FallbackGroup>(group)) {
// Assumed that two fallback groups can always be appended
GroupInfo & lastGroupInfo = result.groups.back();
if (std::get_if<FallbackGroup>(&lastGroupInfo.group)) {
lastGroupInfo.rawString += groupDelimiterChar;
lastGroupInfo.rawString += groupString;
return;
}
}
GroupInfo groupInfo(std::move(group), reportPart, groupString);
result.groups.push_back(std::move(groupInfo));
}
std::string Parser::ReportInput::getNextGroup() {
if (finished) return std::string();
// ASCII control codes and spaces are concidered delimiters
while (report[pos] <= ' ') {
if (pos >= report.length()) {
finished = true;
return std::string();
}
pos++;
}
size_t groupLen = 0;
while (report[pos + groupLen] > ' ') {
// Detect end of report or report end char
if (pos >= report.length() || report[pos + groupLen] == reportEndChar) {
finished = true;
break;
// return report.substr(pos, groupLen);
}
// Treat '+' character as a delimiter to extract groups like BLU+ but
// ignore '+' character if it is in front of the group (e.g. +RA)
if (groupLen && report[pos+groupLen] == '+') { groupLen++; break; }
groupLen++;
}
const auto prevPos = pos;
pos = pos + groupLen;
return report.substr(prevPos, groupLen);
}
ReportPart Parser::Status::getReportPart() {
switch (state) {
case State::REPORT_TYPE_OR_LOCATION:
case State::CORRECTION:
case State::LOCATION:
case State::REPORT_TIME:
case State::TIME_SPAN:
return ReportPart::HEADER;
case State::REPORT_BODY_BEGIN_METAR:
case State::REPORT_BODY_BEGIN_METAR_REPEAT_PARSE:
case State::REPORT_BODY_METAR:
return ReportPart::METAR;
case State::REPORT_BODY_BEGIN_TAF:
case State::REPORT_BODY_TAF:
return ReportPart::TAF;
case State::REMARK_METAR:
case State::REMARK_TAF:
return ReportPart::RMK;
case State::NIL:
case State::CNL:
case State::ERROR:
return ReportPart::UNKNOWN;
}
}
void Parser::Status::transition(SyntaxGroup group) {
switch (state) {
case State::REPORT_TYPE_OR_LOCATION:
transitionFromReportTypeOrLocation(group);
break;
case State::CORRECTION:
transitionFromCorrecton(group);
break;
case State::LOCATION:
if (group == SyntaxGroup::LOCATION) {setState(State::REPORT_TIME); break;}
setError(ReportError::EXPECTED_LOCATION);
break;
case State::REPORT_TIME:
transitionFromReportTime(group);
break;
case State::TIME_SPAN:
transitionFromTimeSpan(group);
break;
case State::REPORT_BODY_BEGIN_METAR:
case State::REPORT_BODY_BEGIN_METAR_REPEAT_PARSE:
transitionFromReportBodyBeginMetar(group);
break;
case State::REPORT_BODY_METAR:
transitionFromReportBodyMetar(group);
break;
case State::REPORT_BODY_BEGIN_TAF:
transitionFromReportBodyBeginTaf(group);
break;
case State::REPORT_BODY_TAF:
transitionFromReportBodyTaf(group);
break;
case State::REMARK_TAF:
if (group == SyntaxGroup::MAINTENANCE_INDICATOR) {
setError(ReportError::MAINTENANCE_INDICATOR_ALLOWED_IN_METAR_ONLY);
}
break;
case State::NIL:
setError(ReportError::UNEXPECTED_GROUP_AFTER_NIL);
break;
case State::CNL:
setError(ReportError::UNEXPECTED_GROUP_AFTER_CNL);
break;
case State::REMARK_METAR:
case State::ERROR:
break;
}
}
void Parser::Status::transitionFromReportTypeOrLocation(SyntaxGroup group) {
switch(group) {
case SyntaxGroup::METAR:
case SyntaxGroup::SPECI:
setReportType(ReportType::METAR);
setState(State::CORRECTION);
break;
case SyntaxGroup::TAF:
setReportType(ReportType::TAF);
setState(State::CORRECTION);
break;
case SyntaxGroup::LOCATION:
setState(State::REPORT_TIME);
break;
default:
setError(ReportError::EXPECTED_REPORT_TYPE_OR_LOCATION);
break;
}
}
void Parser::Status::transitionFromCorrecton(SyntaxGroup group) {
switch (group) {
case SyntaxGroup::AMD:
setState(State::LOCATION);
if (getReportType() != ReportType::TAF)
setError(ReportError::AMD_ALLOWED_IN_TAF_ONLY);
break;
case SyntaxGroup::COR:
setState(State::LOCATION);
break;
case SyntaxGroup::LOCATION:
setState(State::REPORT_TIME);
break;
default:
setError(ReportError::EXPECTED_LOCATION);
break;
}
}
void Parser::Status::transitionFromReportTime(SyntaxGroup group) {
switch (group) {
case SyntaxGroup::REPORT_TIME:
if (reportType == ReportType::METAR) {
setState(State::REPORT_BODY_BEGIN_METAR);
break;
}
setState(State::TIME_SPAN);
break;
case SyntaxGroup::TIME_SPAN:
if (getReportType() == ReportType::TAF) {
setState(State::REPORT_BODY_BEGIN_TAF);
break;
}
setError(ReportError::EXPECTED_REPORT_TIME);
break;
case SyntaxGroup::NIL:
setState(State::NIL);
break;
default:
setError(ReportError::EXPECTED_REPORT_TIME);
break;
}
}
void Parser::Status::transitionFromTimeSpan(SyntaxGroup group) {
switch(group) {
case SyntaxGroup::TIME_SPAN:
setReportType(ReportType::TAF);
setState(State::REPORT_BODY_BEGIN_TAF);
break;
case SyntaxGroup::NIL:
setState(State::NIL);
break;
default:
if (getReportType() == ReportType::UNKNOWN) {
setReportType(ReportType::METAR);
setState(State::REPORT_BODY_BEGIN_METAR_REPEAT_PARSE);
break;
}
setError(ReportError::EXPECTED_TIME_SPAN);
break;
}
}
void Parser::Status::transitionFromReportBodyBeginMetar(SyntaxGroup group) {
switch(group) {
case SyntaxGroup::NIL:
setState(State::NIL);
break;
case SyntaxGroup::CNL:
setError(ReportError::CNL_ALLOWED_IN_TAF_ONLY);
break;
case SyntaxGroup::RMK:
setState(State::REMARK_METAR);
break;
default:
setState(State::REPORT_BODY_METAR);
break;
}
}
void Parser::Status::transitionFromReportBodyMetar(SyntaxGroup group) {
switch(group) {
case SyntaxGroup::RMK:
setState(State::REMARK_METAR);
break;
case SyntaxGroup::NIL:
case SyntaxGroup::CNL:
setError(ReportError::UNEXPECTED_NIL_OR_CNL_IN_REPORT_BODY);
break;
default:
break;
}
}
void Parser::Status::transitionFromReportBodyBeginTaf(SyntaxGroup group) {
switch(group) {
case SyntaxGroup::NIL:
setState(State::NIL);
break;
case SyntaxGroup::CNL:
setState(State::CNL);
break;
case SyntaxGroup::RMK:
setState(State::REMARK_TAF);
break;
case SyntaxGroup::MAINTENANCE_INDICATOR:
setError(ReportError::MAINTENANCE_INDICATOR_ALLOWED_IN_METAR_ONLY);
break;
default:
setState(State::REPORT_BODY_TAF);
break;
}
}
void Parser::Status::transitionFromReportBodyTaf(SyntaxGroup group) {
switch(group) {
case SyntaxGroup::RMK:
setState(State::REMARK_TAF);
break;
case SyntaxGroup::NIL:
case SyntaxGroup::CNL:
setError(ReportError::UNEXPECTED_NIL_OR_CNL_IN_REPORT_BODY);
break;
case SyntaxGroup::MAINTENANCE_INDICATOR:
setError(ReportError::MAINTENANCE_INDICATOR_ALLOWED_IN_METAR_ONLY);
break;
default:
break;
}
}
void Parser::Status::finalTransition() {
switch (state) {
case State::REPORT_BODY_METAR:
case State::REPORT_BODY_TAF:
case State::REMARK_METAR:
case State::REMARK_TAF:
case State::NIL:
case State::CNL:
case State::ERROR:
break;
case State::REPORT_TYPE_OR_LOCATION:
setError(ReportError::EMPTY_REPORT);
break;
case State::CORRECTION:
case State::LOCATION:
case State::REPORT_TIME:
case State::TIME_SPAN:
case State::REPORT_BODY_BEGIN_METAR:
case State::REPORT_BODY_BEGIN_METAR_REPEAT_PARSE:
case State::REPORT_BODY_BEGIN_TAF:
setError(ReportError::UNEXPECTED_REPORT_END);
break;
}
}
void Parser::updateMetadata(const Group & group, ReportMetadata & reportMetadata) {
if (const auto keyword = std::get_if<KeywordGroup>(&group); keyword)
switch (keyword->type()) {
case KeywordGroup::Type::SPECI:
reportMetadata.isSpeci = true;
break;
case KeywordGroup::Type::NOSPECI:
reportMetadata.isNospeci = true;
break;
case KeywordGroup::Type::AUTO: reportMetadata.isAutomated = true;
break;
case KeywordGroup::Type::AO1:
reportMetadata.isAo1 = true;
break;
case KeywordGroup::Type::AO1A:
reportMetadata.isAo1a = true;
break;
case KeywordGroup::Type::AO2:
reportMetadata.isAo2 = true;
break;
case KeywordGroup::Type::AO2A:
reportMetadata.isAo2a = true;
break;
case KeywordGroup::Type::NIL:
reportMetadata.isNil = true;
break;
case KeywordGroup::Type::CNL:
reportMetadata.isCancelled = true;
break;
case KeywordGroup::Type::AMD:
reportMetadata.isAmended = true;
break;
case KeywordGroup::Type::COR:
reportMetadata.isCorrectional = true;
break;
case KeywordGroup::Type::MAINTENANCE_INDICATOR:
reportMetadata.maintenanceIndicator = true;
break;
default:
break;
}
if (const auto reportTime = std::get_if<ReportTimeGroup>(&group); reportTime) {
reportMetadata.reportTime = reportTime->time();
}
if (const auto location = std::get_if<LocationGroup>(&group); location)
reportMetadata.icaoLocation = location->toString();
if (const auto misc = std::get_if<MiscGroup>(&group);
misc &&
misc->type() == MiscGroup::Type::CORRECTED_WEATHER_OBSERVATION &&
misc->data().has_value()) {
reportMetadata.isCorrectional = true;
reportMetadata.correctionNumber = *misc->data();
}
if (const auto trend = std::get_if<TrendGroup>(&group);
trend &&
reportMetadata.type != ReportType::METAR &&
trend->type() == TrendGroup::Type::TIME_SPAN &&
!reportMetadata.timeSpanFrom.has_value() &&
!reportMetadata.timeSpanUntil.has_value())
{
reportMetadata.timeSpanFrom = trend->timeFrom();
reportMetadata.timeSpanUntil = trend->timeUntil();
}
}
} //namespace metaf
#endif //#ifndef METAF_HPP
| 33.404314
| 117
| 0.712235
|
nnaumenko
|
12364060df01a71d8fda729a3115a586ba73a938
| 5,040
|
cpp
|
C++
|
src/programs/rexi_approximation.cpp
|
valentinaschueller/sweet
|
27e99c7a110c99deeadee70688c186d82b39ac90
|
[
"MIT"
] | 6
|
2017-11-20T08:12:46.000Z
|
2021-03-11T15:32:36.000Z
|
src/programs/rexi_approximation.cpp
|
valentinaschueller/sweet
|
27e99c7a110c99deeadee70688c186d82b39ac90
|
[
"MIT"
] | 4
|
2018-02-02T21:46:33.000Z
|
2022-01-11T11:10:27.000Z
|
src/programs/rexi_approximation.cpp
|
valentinaschueller/sweet
|
27e99c7a110c99deeadee70688c186d82b39ac90
|
[
"MIT"
] | 12
|
2016-03-01T18:33:34.000Z
|
2022-02-08T22:20:31.000Z
|
/*
* Author: Martin Schreiber <SchreiberX@gmail.com>
*/
#include <rexi/EXPFunctions.hpp>
#include <iostream>
#include <rexi/REXI.hpp>
#include <rexi/REXICoefficients.hpp>
#include <rexi/REXICoefficientsSet.hpp>
#include <sweet/SimulationVariables.hpp>
#include <sweet/Timeloop.hpp>
#include <stdlib.h>
typedef double T;
typedef std::complex<T> TComplex;
std::string function_name;
int main(
int i_argc,
char *const i_argv[]
)
{
//input parameter names (specific ones for this program)
const char *bogus_var_names[] = {
"function-name", /// Frequency multipliers for special scenario setup
"lambda-real", /// Real part of lambda
"lambda-imag", /// Imaginary part of lambda
"test-mode", /// Type of test
nullptr
};
SimulationVariables simVars;
simVars.bogus.var[0] = "";
simVars.bogus.var[1] = "";
simVars.bogus.var[2] = "";
simVars.bogus.var[3] = "";
if (!simVars.setupFromMainParameters(i_argc, i_argv, bogus_var_names, false))
{
std::cout << "User variables:" << std::endl;
std::cout << std::endl;
std::cout << " --function-name=..." << std::endl;
std::cout << " --lambda-real=..." << std::endl;
std::cout << " --lambda-imag=..." << std::endl;
std::cout << " --test-mode=..." << std::endl;
std::cout << " 0: use standard time stepping" << std::endl;
std::cout << " 1: always start from u(0) with increasing time step sizes" << std::endl;
return -1;
}
std::string function_name;
if (simVars.bogus.var[0] != "")
function_name = simVars.bogus.var[0];
double lambda_real = std::numeric_limits<double>::infinity();
if (simVars.bogus.var[1] != "")
lambda_real = atof(simVars.bogus.var[1].c_str());
double lambda_imag = std::numeric_limits<double>::infinity();
if (simVars.bogus.var[2] != "")
lambda_imag = atof(simVars.bogus.var[2].c_str());
std::complex<double> lambda(lambda_real, lambda_imag);
int test_mode = 0;
if (simVars.bogus.var[3] != "")
lambda_imag = atoi(simVars.bogus.var[3].c_str());
if (simVars.timecontrol.current_timestep_size <= 0)
{
std::cerr << "Error: Specify time step size" << std::endl;
return -1;
}
if (std::isinf(std::abs(lambda)))
{
std::cerr << "Error: Specify \\lambda of linear operators" << std::endl;
return -1;
}
/*
* Load analytical function
*/
EXPFunctions<double> rexiFunctions;
rexiFunctions.setup(function_name);
/*
* Load REXI coefficients from file
*/
REXICoefficientsSet<> rexiCoefficientsSet;
if (simVars.rexi.exp_method == "direct")
{
SWEETError("Direct REXI mode not supported");
}
else if (simVars.rexi.exp_method == "file")
{
rexiCoefficientsSet.setup_from_files(simVars.rexi.rexi_files);
if (rexiCoefficientsSet.rexiCoefficientVector.size() == 0)
SWEETError("No REXI coefficient loaded");
}
else if (simVars.rexi.exp_method == "terry" || simVars.rexi.exp_method == "ci")
{
REXICoefficients<> rexiCoefficients;
REXI<> rexi;
rexi.load(&simVars.rexi, function_name, rexiCoefficients, 0);
rexiCoefficientsSet.rexiCoefficientVector.push_back(rexiCoefficients);
}
else
{
SWEETError("This REXI method is not supported");
}
std::cout << "+ test_mode: " << test_mode << std::endl;
simVars.rexi.outputConfig();
for (std::size_t i = 0; i < rexiCoefficientsSet.rexiCoefficientVector.size(); i++)
{
const std::string &function_name = rexiCoefficientsSet.rexiCoefficientVector[i].function_name;
std::cout << "Running tests for function " << function_name << std::endl;
// Load coefficients for function
REXICoefficients<> rexiCoeffs = rexiCoefficientsSet.find_by_function_name(function_name);
// Initial condition
std::complex<double> U0(1.0, 0.0);
// Current solution
std::complex<double> U = U0;
auto computeAndOutputError = [&](std::complex<double> &i_U) -> double
{
TComplex analU = rexiFunctions.eval(lambda*simVars.timecontrol.current_simulation_time);
double error = std::abs(analU-U);
std::cout <<
"t=" << simVars.timecontrol.current_simulation_time << "\t"
"error=" << error
<< std::endl;
return error;
};
SWEET_TIMELOOP
{
computeAndOutputError(U);
// REXI time integration
{
std::complex<double> approx = rexiCoeffs.gamma*U;
for (std::size_t i = 0; i < rexiCoeffs.alphas.size(); i++)
approx += rexiCoeffs.betas[i]/(lambda*simVars.timecontrol.current_timestep_size + rexiCoeffs.alphas[i])*U;
U = approx;
}
}
double error = computeAndOutputError(U);
std::cout << "[MULE] error: " << error << std::endl;
}
/*
std::vector< std::complex<double> > alpha;
std::vector< std::complex<double> > beta;
if (simVars.rexi.exp_method == "ci")
if (simVars.timecontrol.current_timestep_size <= 0)
SWEETError("Please specify time step size with --dt=...");
*/
/*
std::cout << "Loading REXI coefficients..." << std::flush;
REXI rexi;
rexi.load(
&simVars.rexi,
function_name,
alpha,
beta,
simVars.timecontrol.current_timestep_size,
simVars.misc.verbosity
);
std::cout << "OK" << std::endl;
*/
return 0;
}
| 25.2
| 111
| 0.670238
|
valentinaschueller
|
1238cce13bdfb99724889eb681b06d0f7bead895
| 2,942
|
cpp
|
C++
|
src/jk/cog/codegen/nonval_expression_gen_visitor.cpp
|
jdmclark/gorc
|
a03d6a38ab7684860c418dd3d2e77cbe6a6d9fc8
|
[
"Apache-2.0"
] | 97
|
2015-02-24T05:09:24.000Z
|
2022-01-23T12:08:22.000Z
|
src/jk/cog/codegen/nonval_expression_gen_visitor.cpp
|
annnoo/gorc
|
1889b4de6380c30af6c58a8af60ecd9c816db91d
|
[
"Apache-2.0"
] | 8
|
2015-03-27T23:03:23.000Z
|
2020-12-21T02:34:33.000Z
|
src/jk/cog/codegen/nonval_expression_gen_visitor.cpp
|
annnoo/gorc
|
1889b4de6380c30af6c58a8af60ecd9c816db91d
|
[
"Apache-2.0"
] | 10
|
2016-03-24T14:32:50.000Z
|
2021-11-13T02:38:53.000Z
|
#include "nonval_expression_gen_visitor.hpp"
#include "rval_expression_gen_visitor.hpp"
#include "lval_expression_gen_visitor.hpp"
using namespace gorc;
using namespace gorc::cog;
nonval_expression_gen_visitor::nonval_expression_gen_visitor(script &out_script,
ir_printer &ir,
verb_table const &verbs,
constant_table const &constants)
: out_script(out_script)
, ir(ir)
, verbs(verbs)
, constants(constants)
{
return;
}
void nonval_expression_gen_visitor::visit(ast::immediate_expression &)
{
// Skip
return;
}
// LCOV_EXCL_START
//
// Literal expressions are folded out. These are normally impossible. Assert.
void nonval_expression_gen_visitor::visit(ast::string_literal_expression &)
{
LOG_FATAL("unhandled string literal expression in code generation");
}
void nonval_expression_gen_visitor::visit(ast::integer_literal_expression &)
{
LOG_FATAL("unhandled integer literal expression in code generation");
}
void nonval_expression_gen_visitor::visit(ast::float_literal_expression &)
{
LOG_FATAL("unhandled float literal expression in code generation");
}
void nonval_expression_gen_visitor::visit(ast::vector_literal_expression &)
{
LOG_FATAL("unhandled vector literal expression in code generation");
}
// LCOV_EXCL_STOP
void nonval_expression_gen_visitor::visit(ast::identifier_expression &)
{
// Skip
return;
}
void nonval_expression_gen_visitor::visit(ast::subscript_expression &e)
{
ast_visit(*this, *e.index);
}
void nonval_expression_gen_visitor::visit(ast::method_call_expression &e)
{
rval_expression_gen_visitor rv(out_script, ir, verbs, constants);
// Push values from left to right
for(auto &arg : e.arguments->elements) {
ast_visit(rv, *arg);
}
ir.call(verbs.get_verb_id(e.base->value), e.location);
}
void nonval_expression_gen_visitor::visit(ast::unary_expression &e)
{
ast_visit(*this, *e.base);
}
void nonval_expression_gen_visitor::visit(ast::infix_expression &e)
{
ast_visit(*this, *e.left);
ast_visit(*this, *e.right);
}
void nonval_expression_gen_visitor::visit(ast::assignment_expression &e)
{
// Push value
rval_expression_gen_visitor ev(out_script, ir, verbs, constants);
ast_visit(ev, *e.value);
// Push index and store
lval_expression_gen_visitor lev(out_script, ir, verbs, constants);
ast_visit(lev, *e.target);
}
void nonval_expression_gen_visitor::visit(ast::comma_expression &e)
{
ast_visit(*this, *e.left);
ast_visit(*this, *e.right);
}
void nonval_expression_gen_visitor::visit(ast::for_empty_expression &)
{
// For empty expression is 'true' constant
return;
}
void nonval_expression_gen_visitor::visit(ast::for_expression &e)
{
ast_visit(*this, *e.condition);
}
| 26.035398
| 93
| 0.699524
|
jdmclark
|
72eb1ad3e16231c824696ced741ea0bb5b80fa47
| 13,510
|
cc
|
C++
|
lighter/application/vulkan/planet.cc
|
VulkanWorks/lighter-Earth-Map-Spline
|
b3a8ab4b3ab0ce3027f337d7991015db8758ded9
|
[
"Apache-2.0"
] | 3
|
2020-09-07T12:26:59.000Z
|
2021-09-04T08:37:54.000Z
|
lighter/application/vulkan/planet.cc
|
lun0522/jessie-steamer
|
74379c9bd685bb9f1b3197a798df40cde5ed4fb2
|
[
"Apache-2.0"
] | null | null | null |
lighter/application/vulkan/planet.cc
|
lun0522/jessie-steamer
|
74379c9bd685bb9f1b3197a798df40cde5ed4fb2
|
[
"Apache-2.0"
] | 1
|
2021-09-04T08:38:03.000Z
|
2021-09-04T08:38:03.000Z
|
//
// planet.cc
//
// Created by Pujun Lun on 4/24/19.
// Copyright © 2019 Pujun Lun. All rights reserved.
//
#include <array>
#include <memory>
#include <numeric>
#include <optional>
#include <random>
#include <vector>
#include "lighter/application/vulkan/util.h"
namespace lighter {
namespace application {
namespace vulkan {
namespace {
using namespace renderer::vulkan;
enum SubpassIndex {
kModelSubpassIndex = 0,
kNumSubpasses,
};
constexpr int kNumAsteroidRings = 3;
constexpr int kNumFramesInFlight = 2;
constexpr int kObjFileIndexBase = 1;
/* BEGIN: Consistent with vertex input attributes defined in shaders. */
struct Asteroid {
// Returns vertex input attributes.
static std::vector<common::VertexAttribute> GetVertexAttributes() {
std::vector<common::VertexAttribute> attributes;
common::data::AppendVertexAttributes<glm::vec1>(
attributes, offsetof(Asteroid, theta));
common::data::AppendVertexAttributes<glm::vec1>(
attributes, offsetof(Asteroid, radius));
common::data::AppendVertexAttributes<glm::mat4>(
attributes, offsetof(Asteroid, model));
return attributes;
}
float theta;
float radius;
glm::mat4 model;
};
/* END: Consistent with vertex input attributes defined in shaders. */
/* BEGIN: Consistent with uniform blocks defined in shaders. */
struct Light {
ALIGN_VEC4 glm::vec4 direction_time;
};
struct PlanetTrans {
ALIGN_MAT4 glm::mat4 model;
ALIGN_MAT4 glm::mat4 proj_view;
};
struct SkyboxTrans {
ALIGN_MAT4 glm::mat4 proj_view_model;
};
/* END: Consistent with uniform blocks defined in shaders. */
class PlanetApp : public Application {
public:
explicit PlanetApp(const WindowContext::Config& config);
// This class is neither copyable nor movable.
PlanetApp(const PlanetApp&) = delete;
PlanetApp& operator=(const PlanetApp&) = delete;
// Overrides.
void MainLoop() override;
private:
// Recreates the swapchain and associated resources.
void Recreate();
// Populates 'num_asteroids_' and 'per_asteroid_data_'.
void GenerateAsteroidModels();
// Updates per-frame data.
void UpdateData(int frame);
// Accessors.
const RenderPass& render_pass() const {
return render_pass_manager_->render_pass();
}
bool should_quit_ = false;
int current_frame_ = 0;
std::optional<int> num_asteroids_;
common::FrameTimer timer_;
std::unique_ptr<common::UserControlledPerspectiveCamera> camera_;
std::unique_ptr<PerFrameCommand> command_;
std::unique_ptr<StaticPerInstanceBuffer> per_asteroid_data_;
std::unique_ptr<UniformBuffer> light_uniform_;
std::unique_ptr<PushConstant> planet_constant_;
std::unique_ptr<PushConstant> skybox_constant_;
std::unique_ptr<Model> planet_model_;
std::unique_ptr<Model> asteroid_model_;
std::unique_ptr<Model> skybox_model_;
std::unique_ptr<OnScreenRenderPassManager> render_pass_manager_;
};
} /* namespace */
PlanetApp::PlanetApp(const WindowContext::Config& window_config)
: Application{"Planet", window_config} {
using common::file::GetResourcePath;
using WindowKey = common::Window::KeyMap;
using ControlKey = common::camera_control::Key;
using TextureType = ModelBuilder::TextureType;
const float original_aspect_ratio = window_context().original_aspect_ratio();
/* Camera */
common::Camera::Config camera_config;
camera_config.position = glm::vec3{1.6f, -5.1f, -5.9f};
camera_config.look_at = glm::vec3{-2.4f, -0.8f, 0.0f};
const common::PerspectiveCamera::FrustumConfig frustum_config{
/*field_of_view_y=*/45.0f, original_aspect_ratio};
camera_ = common::UserControlledPerspectiveCamera::Create(
/*control_config=*/{}, camera_config, frustum_config);
/* Window */
(*mutable_window_context()->mutable_window())
.SetCursorHidden(true)
.RegisterMoveCursorCallback([this](double x_pos, double y_pos) {
camera_->DidMoveCursor(x_pos, y_pos);
})
.RegisterScrollCallback([this](double x_pos, double y_pos) {
camera_->DidScroll(y_pos, 1.0f, 60.0f);
})
.RegisterPressKeyCallback(WindowKey::kUp, [this]() {
camera_->DidPressKey(ControlKey::kUp,
timer_.GetElapsedTimeSinceLastFrame());
})
.RegisterPressKeyCallback(WindowKey::kDown, [this]() {
camera_->DidPressKey(ControlKey::kDown,
timer_.GetElapsedTimeSinceLastFrame());
})
.RegisterPressKeyCallback(WindowKey::kLeft, [this]() {
camera_->DidPressKey(ControlKey::kLeft,
timer_.GetElapsedTimeSinceLastFrame());
})
.RegisterPressKeyCallback(WindowKey::kRight, [this]() {
camera_->DidPressKey(ControlKey::kRight,
timer_.GetElapsedTimeSinceLastFrame());
})
.RegisterPressKeyCallback(WindowKey::kEscape,
[this]() { should_quit_ = true; });
/* Command buffer */
command_ = std::make_unique<PerFrameCommand>(context(), kNumFramesInFlight);
/* Uniform buffer and push constant */
light_uniform_ = std::make_unique<UniformBuffer>(
context(), sizeof(Light), kNumFramesInFlight);
planet_constant_ = std::make_unique<PushConstant>(
context(), sizeof(PlanetTrans), kNumFramesInFlight);
skybox_constant_ = std::make_unique<PushConstant>(
context(), sizeof(SkyboxTrans), kNumFramesInFlight);
/* Model */
planet_model_ = ModelBuilder{
context(), "Planet", kNumFramesInFlight, original_aspect_ratio,
ModelBuilder::SingleMeshResource{
GetResourcePath("model/sphere.obj"), kObjFileIndexBase,
/*tex_source_map=*/{{
TextureType::kDiffuse,
{SharedTexture::SingleTexPath{
GetResourcePath("texture/planet.png")}},
}}
}}
.AddTextureBindingPoint(TextureType::kDiffuse, /*binding_point=*/2)
.AddUniformBinding(
VK_SHADER_STAGE_FRAGMENT_BIT,
/*bindings=*/{{/*binding_point=*/1, /*array_length=*/1}})
.AddUniformBuffer(/*binding_point=*/1, *light_uniform_)
.SetPushConstantShaderStage(VK_SHADER_STAGE_VERTEX_BIT)
.AddPushConstant(planet_constant_.get(), /*target_offset=*/0)
.SetShader(VK_SHADER_STAGE_VERTEX_BIT,
GetShaderBinaryPath("planet/planet.vert"))
.SetShader(VK_SHADER_STAGE_FRAGMENT_BIT,
GetShaderBinaryPath("planet/planet.frag"))
.Build();
GenerateAsteroidModels();
asteroid_model_ = ModelBuilder{
context(), "Asteroid", kNumFramesInFlight, original_aspect_ratio,
ModelBuilder::MultiMeshResource{
/*model_path=*/GetResourcePath("model/rock/rock.obj"),
/*texture_dir=*/
GetResourcePath("model/rock/rock.obj", /*want_directory_path=*/true)}}
.AddTextureBindingPoint(TextureType::kDiffuse, /*binding_point=*/2)
.AddPerInstanceBuffer(per_asteroid_data_.get())
.AddUniformBinding(
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
/*bindings=*/{{/*binding_point=*/1, /*array_length=*/1}})
.AddUniformBuffer(/*binding_point=*/1, *light_uniform_)
.SetPushConstantShaderStage(VK_SHADER_STAGE_VERTEX_BIT)
.AddPushConstant(planet_constant_.get(), /*target_offset=*/0)
.SetShader(VK_SHADER_STAGE_VERTEX_BIT,
GetShaderBinaryPath("planet/asteroid.vert"))
.SetShader(VK_SHADER_STAGE_FRAGMENT_BIT,
GetShaderBinaryPath("planet/planet.frag"))
.Build();
const SharedTexture::CubemapPath skybox_path{
/*directory=*/
GetResourcePath("texture/universe/PositiveX.jpg",
/*want_directory_path=*/true),
/*files=*/{
"PositiveX.jpg", "NegativeX.jpg",
"PositiveY.jpg", "NegativeY.jpg",
"PositiveZ.jpg", "NegativeZ.jpg",
},
};
skybox_model_ = ModelBuilder{
context(), "Skybox", kNumFramesInFlight, original_aspect_ratio,
ModelBuilder::SingleMeshResource{
GetResourcePath("model/skybox.obj"), kObjFileIndexBase,
{{TextureType::kCubemap, {skybox_path}}},
}}
.AddTextureBindingPoint(TextureType::kCubemap, /*binding_point=*/1)
.SetPushConstantShaderStage(VK_SHADER_STAGE_VERTEX_BIT)
.AddPushConstant(skybox_constant_.get(), /*target_offset=*/0)
.SetShader(VK_SHADER_STAGE_VERTEX_BIT,
GetShaderBinaryPath("shared/skybox.vert"))
.SetShader(VK_SHADER_STAGE_FRAGMENT_BIT,
GetShaderBinaryPath("shared/skybox.frag"))
.Build();
/* Render pass */
render_pass_manager_ = std::make_unique<OnScreenRenderPassManager>(
&window_context(),
NaiveRenderPass::SubpassConfig{
kNumSubpasses, /*first_transparent_subpass=*/std::nullopt,
/*first_overlay_subpass=*/std::nullopt});
}
void PlanetApp::Recreate() {
/* Camera */
camera_->SetCursorPos(window_context().window().GetCursorPos());
/* Render pass */
render_pass_manager_->RecreateRenderPass();
/* Model */
constexpr bool kIsObjectOpaque = true;
const VkExtent2D& frame_size = window_context().frame_size();
const VkSampleCountFlagBits sample_count = window_context().sample_count();
planet_model_->Update(kIsObjectOpaque, frame_size, sample_count,
render_pass(), kModelSubpassIndex);
asteroid_model_->Update(kIsObjectOpaque, frame_size, sample_count,
render_pass(), kModelSubpassIndex);
skybox_model_->Update(kIsObjectOpaque, frame_size, sample_count,
render_pass(), kModelSubpassIndex);
}
void PlanetApp::GenerateAsteroidModels() {
const std::array<int, kNumAsteroidRings> num_asteroid = {300, 500, 700};
const std::array<float, kNumAsteroidRings> radii = {6.0f, 12.0f, 18.0f};
// Randomly generate rotation, radius and scale for each asteroid.
std::random_device device;
std::mt19937 rand_gen{device()};
std::uniform_real_distribution<float> axis_gen{0.0f, 1.0f};
std::uniform_real_distribution<float> angle_gen{0.0f, 360.0f};
std::uniform_real_distribution<float> radius_gen{-1.5f, 1.5f};
std::uniform_real_distribution<float> scale_gen{1.0f, 3.0f};
num_asteroids_ = static_cast<int>(std::accumulate(
num_asteroid.begin(), num_asteroid.end(), 0));
std::vector<Asteroid> asteroids;
asteroids.reserve(num_asteroids_.value());
for (int ring = 0; ring < kNumAsteroidRings; ++ring) {
for (int i = 0; i < num_asteroid[ring]; ++i) {
glm::mat4 model{1.0f};
model = glm::rotate(model, glm::radians(angle_gen(rand_gen)),
glm::vec3{axis_gen(rand_gen), axis_gen(rand_gen),
axis_gen(rand_gen)});
model = glm::scale(model, glm::vec3{scale_gen(rand_gen) * 0.02f});
asteroids.push_back(Asteroid{
/*theta=*/glm::radians(angle_gen(rand_gen)),
/*radius=*/radii[ring] + radius_gen(rand_gen),
model,
});
}
}
per_asteroid_data_ = std::make_unique<StaticPerInstanceBuffer>(
context(), asteroids, pipeline::GetVertexAttributes<Asteroid>());
}
void PlanetApp::UpdateData(int frame) {
const float elapsed_time = timer_.GetElapsedTimeSinceLaunch();
const glm::vec3 light_dir{glm::sin(elapsed_time * 0.6f), -0.3f,
glm::cos(elapsed_time * 0.6f)};
*light_uniform_->HostData<Light>(frame) =
{glm::vec4{light_dir, elapsed_time}};
light_uniform_->Flush(frame);
glm::mat4 model{1.0f};
model = glm::rotate(model, elapsed_time * glm::radians(5.0f),
glm::vec3{0.0f, 1.0f, 0.0f});
const common::Camera& camera = camera_->camera();
const glm::mat4 proj = camera.GetProjectionMatrix();
*planet_constant_->HostData<PlanetTrans>(frame) =
{model, proj * camera.GetViewMatrix()};
skybox_constant_->HostData<SkyboxTrans>(frame)->proj_view_model =
proj * camera.GetSkyboxViewMatrix();
}
void PlanetApp::MainLoop() {
const auto update_data = [this](int frame) { UpdateData(frame); };
Recreate();
while (!should_quit_ && mutable_window_context()->CheckEvents()) {
timer_.Tick();
const std::vector<RenderPass::RenderOp> render_ops{
[this](const VkCommandBuffer& command_buffer) {
planet_model_->Draw(command_buffer, current_frame_,
/*instance_count=*/1);
asteroid_model_->Draw(command_buffer, current_frame_,
static_cast<uint32_t>(num_asteroids_.value()));
skybox_model_->Draw(command_buffer, current_frame_,
/*instance_count=*/1);
},
};
const auto draw_result = command_->Run(
current_frame_, window_context().swapchain(), update_data,
[this, &render_ops](const VkCommandBuffer& command_buffer,
uint32_t framebuffer_index) {
render_pass().Run(command_buffer, framebuffer_index, render_ops);
});
if (draw_result.has_value() || window_context().ShouldRecreate()) {
mutable_window_context()->Recreate();
Recreate();
}
current_frame_ = (current_frame_ + 1) % kNumFramesInFlight;
// Camera is not activated until first frame is displayed.
camera_->SetActivity(true);
}
mutable_window_context()->OnExit();
}
} /* namespace vulkan */
} /* namespace application */
} /* namespace lighter */
int main(int argc, char* argv[]) {
using namespace lighter::application::vulkan;
return AppMain<PlanetApp>(argc, argv, WindowContext::Config{});
}
| 36.415094
| 80
| 0.677942
|
VulkanWorks
|
72f26bde1c3eb0cf2c1bf4d6b778822731f9a097
| 467
|
hpp
|
C++
|
include/animation/transition_trigger_condition.hpp
|
hermet/rive-cpp
|
d69378d97e7d987930c3764655153bf8ddc65966
|
[
"MIT"
] | 2
|
2021-04-21T08:25:07.000Z
|
2021-04-21T08:48:42.000Z
|
include/animation/transition_trigger_condition.hpp
|
hermet/rive-cpp
|
d69378d97e7d987930c3764655153bf8ddc65966
|
[
"MIT"
] | null | null | null |
include/animation/transition_trigger_condition.hpp
|
hermet/rive-cpp
|
d69378d97e7d987930c3764655153bf8ddc65966
|
[
"MIT"
] | null | null | null |
#ifndef _RIVE_TRANSITION_TRIGGER_CONDITION_HPP_
#define _RIVE_TRANSITION_TRIGGER_CONDITION_HPP_
#include "generated/animation/transition_trigger_condition_base.hpp"
#include <stdio.h>
namespace rive
{
class TransitionTriggerCondition : public TransitionTriggerConditionBase
{
public:
bool evaluate(const SMIInput* inputInstance) const override;
protected:
bool validateInputType(const StateMachineInput* input) const override;
};
} // namespace rive
#endif
| 27.470588
| 73
| 0.832976
|
hermet
|
72fa8b99497bc080fb7d448afe503cef782d4129
| 1,432
|
hh
|
C++
|
src/main/c++/novemberizing/concurrency/thread.hh
|
iticworld/reactive-lib
|
9ab761376776e759390fa417d50921ec6e8a898a
|
[
"Apache-2.0"
] | 1
|
2020-10-10T11:57:15.000Z
|
2020-10-10T11:57:15.000Z
|
src/main/c++/novemberizing/concurrency/thread.hh
|
iticworld/reactive-lib
|
9ab761376776e759390fa417d50921ec6e8a898a
|
[
"Apache-2.0"
] | null | null | null |
src/main/c++/novemberizing/concurrency/thread.hh
|
iticworld/reactive-lib
|
9ab761376776e759390fa417d50921ec6e8a898a
|
[
"Apache-2.0"
] | null | null | null |
#ifndef __NOVEMBERIZING_CONCURRENCY__THREAD__HH__
#define __NOVEMBERIZING_CONCURRENCY__THREAD__HH__
#include <pthread.h>
#include <string.h>
#include <signal.h>
#include <novemberizing.hh>
#include <novemberizing/util/log.hh>
#include <novemberizing/ds/runnable.hh>
namespace novemberizing { namespace concurrency {
using namespace ds;
class Thread : public Runnable
{
/**
* http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html
*/
public: template <class T>
class Local
{
public: inline static void Destructor(void * p);
private: pthread_key_t __key;
public: inline T get(void);
public: inline void set(const T & v);
public: inline Local(void);
public: inline virtual ~Local(void);
};
private: static void * Routine(void * param);
private: pthread_t __threadid;
private: pthread_attr_t __threadattr;
private: Runnable * __runnable;
public: virtual void cancel(bool v);
public: virtual bool alive(void);
public: virtual int start(void);
public: virtual int stop(void);
public: Thread(void);
public: Thread(Runnable * runnable);
public: virtual ~Thread(void);
};
} }
#include <novemberizing/concurrency/thread.local.inline.hh>
#endif // __NOVEMBERIZING_CONCURRENCY__THREAD__HH__
| 28.078431
| 95
| 0.65852
|
iticworld
|
72fd0945ad674dca76a69e7772c04f8d6836e8dd
| 1,720
|
cpp
|
C++
|
CodeChef/VANDH/solution.cpp
|
afifabroory/CompetitiveProgramming
|
231883eeab5abbd84005e80c5065dd02fd8430ef
|
[
"Unlicense"
] | null | null | null |
CodeChef/VANDH/solution.cpp
|
afifabroory/CompetitiveProgramming
|
231883eeab5abbd84005e80c5065dd02fd8430ef
|
[
"Unlicense"
] | null | null | null |
CodeChef/VANDH/solution.cpp
|
afifabroory/CompetitiveProgramming
|
231883eeab5abbd84005e80c5065dd02fd8430ef
|
[
"Unlicense"
] | null | null | null |
#include <iostream>
#include <cmath>
using namespace std;
void solve(unsigned hills, unsigned valley) {
unsigned short stringLength = hills+valley + 3;
// Odd for Valley. Even for Hills
unsigned short who;
if (hills > valley) {
who = 1; // Valley first
if (hills - valley > 1) {
if (hills%2 == 0) stringLength += hills/2 * 2;
else if (hills%2 != 0 && valley%2 == 0) stringLength += (((float) hills/2) * 2) - 1;
else stringLength += (valley/2) * 2;
}
valley++;
}
else {
who = 2; // Hills First
if (valley - hills > 1) {
if (valley%2 == 0) stringLength += valley/2 * 2;
else if (valley%2 != 0 && hills%2 == 0) stringLength += (((float) valley/2) * 2) - 1;
else stringLength += (hills/2) * 2;
}
hills++;
}
string binaryString;
stringLength = 0;
while (hills > 0 || valley > 0) {
if (who%2 == 0) {
binaryString.push_back('1');
if (hills != 0) hills--;
else {
binaryString.push_back('1');
stringLength++;
}
who = 1;
}
else {
binaryString.push_back('0');
if (valley != 0) valley--;
else {
binaryString.push_back('0');
stringLength++;
}
who = 2;
}
stringLength++;
}
if (who == 2) binaryString.push_back('1');
else binaryString.push_back('0');
cout << stringLength+1 << '\n' << binaryString << '\n';
}
int main() {
unsigned short testCase;
cin >> testCase;
unsigned short hills, valley;
while (testCase--) {
cin >> hills >> valley;
solve(hills, valley);
}
return 0;
}
| 23.561644
| 98
| 0.503488
|
afifabroory
|
72ffde0b60dccaddee7807c08bfbf4e05494a262
| 5,957
|
cpp
|
C++
|
examples/swap_motes/dht22/main.cpp
|
ekoeppen/msp430-template-library
|
ee054ac66fd07f957f872db0db50aa20382483b8
|
[
"MIT"
] | 6
|
2017-04-16T21:01:31.000Z
|
2021-07-27T17:52:14.000Z
|
examples/swap_motes/dht22/main.cpp
|
ekoeppen/msp430-template-library
|
ee054ac66fd07f957f872db0db50aa20382483b8
|
[
"MIT"
] | null | null | null |
examples/swap_motes/dht22/main.cpp
|
ekoeppen/msp430-template-library
|
ee054ac66fd07f957f872db0db50aa20382483b8
|
[
"MIT"
] | 2
|
2019-04-20T11:39:09.000Z
|
2020-11-06T15:03:18.000Z
|
#define DEBUG
#include <msp430.h>
#include <stdint.h>
#include <string.h>
#include <gpio.h>
#include <clocks.h>
#include <wdt.h>
#include <io.h>
#include <timer.h>
#include <nrf24.h>
#include <flash.h>
#include <adc.h>
#include <dht22.h>
#include <utils.h>
#ifdef __MSP430_HAS_USCI__
#include <usci_spi.h>
#include <usci_uart.h>
#else
#include <usi_spi.h>
#include <soft_uart.h>
#endif
#include <swap_mote.h>
typedef VLOCLK_T<> VLO;
typedef DCOCLK_T<> DCO;
typedef ACLK_T<VLO> ACLK;
typedef MCLK_T<DCO> MCLK;
typedef SMCLK_T<DCO> SMCLK;
#ifdef __MSP430_HAS_USCI__
typedef GPIO_MODULE_T<1, 1, 3> RX;
typedef GPIO_MODULE_T<1, 2, 3> TX;
typedef GPIO_MODULE_T<1, 5, 3> SCLK;
typedef GPIO_MODULE_T<1, 6, 3> MISO;
typedef GPIO_MODULE_T<1, 7, 3> MOSI;
#else
typedef GPIO_INPUT_T<1, 1> RX;
typedef GPIO_OUTPUT_T<1, 2> TX;
typedef GPIO_PIN_T<1, 5, OUTPUT, LOW, INTERRUPT_DISABLED, TRIGGER_RISING, 1> SCLK;
typedef GPIO_PIN_T<1, 6, OUTPUT, LOW, INTERRUPT_DISABLED, TRIGGER_RISING, 1> MOSI;
typedef GPIO_PIN_T<1, 7, INPUT, LOW, INTERRUPT_DISABLED, TRIGGER_RISING, 1> MISO;
#endif
typedef GPIO_OUTPUT_T<1, 0, LOW> LED_RED;
typedef GPIO_OUTPUT_T<2, 0, LOW> CE;
typedef GPIO_OUTPUT_T<2, 1, HIGH> CSN;
typedef GPIO_INPUT_T<2, 2> IRQ;
typedef GPIO_PIN_T<2, 3, OUTPUT, LOW> DHT_POWER;
typedef GPIO_PIN_T<2, 5, OUTPUT, HIGH> DHT_DATA;
typedef GPIO_PORT_T<1, LED_RED, SCLK, MISO, MOSI, RX, TX> PORT1;
typedef GPIO_PORT_T<2, IRQ, CSN, CE, DHT_POWER, DHT_DATA> PORT2;
typedef TIMER_T<TIMER_A, 0, SMCLK, TIMER_MODE_CONTINUOUS> TIMER;
typedef WDT_T<ACLK, WDT_TIMER, WDT_INTERVAL_512> WDT;
#ifdef __MSP430_HAS_USCI__
#ifdef DEBUG
typedef USCI_UART_T<USCI_A, 0, SMCLK> UART;
#else
typedef DISABLED_UART UART;
#endif
typedef USCI_SPI_T<USCI_B, 0, SMCLK, true, 0> SPI;
#else
#ifdef DEBUG
typedef SOFT_UART_T<TIMER, TX, RX> UART;
#else
typedef DISABLED_UART UART;
#endif
typedef USI_SPI_T<SMCLK, true, 0> SPI;
#endif
typedef TIMEOUT_T<WDT> TIMEOUT;
typedef FLASH_T<SMCLK, WDT, &__infod> CONFIGURATION;
template<const uint32_t ID, typename TIMER, typename TIMEOUT, typename DATA, typename POWER>
struct TEMP_HUM_REGISTER_T {
static int16_t temperature;
static uint16_t humidity;
static constexpr uint8_t reg_id = ID;
static bool write(SWAP_PACKET& packet) {
packet.reg_id = ID;
packet.reg_value[0] = temperature >> 8;
packet.reg_value[1] = temperature & 0xff;
packet.reg_value[2] = humidity >> 8;
packet.reg_value[3] = humidity & 0xff;
packet.len = 7 + 4;
return true;
};
static bool handle_command(SWAP_PACKET& packet) { return false; }
static bool handle_query(SWAP_PACKET& packet) { return false; }
static void update(void) {
int r;
temperature = humidity = 0;
r = read_dht<TIMER, TIMEOUT, DATA, POWER>(&temperature, &humidity);
printf<UART>("Temperature: %d Humidity: %d (%d)\n", temperature, humidity, r);
temperature += 500;
};
};
template<const uint32_t ID, typename TIMER, typename TIMEOUT, typename DATA, typename POWER>
int16_t TEMP_HUM_REGISTER_T<ID, TIMER, TIMEOUT, DATA, POWER>::temperature = 0;
template<const uint32_t ID, typename TIMER, typename TIMEOUT, typename DATA, typename POWER>
uint16_t TEMP_HUM_REGISTER_T<ID, TIMER, TIMEOUT, DATA, POWER>::humidity = 0;
template<const uint32_t ID>
struct VOLTAGE_REGISTER_T {
static uint16_t value;
static constexpr uint8_t reg_id = ID;
static bool write(SWAP_PACKET& packet) {
packet.reg_id = ID;
packet.reg_value[0] = value >> 8;
packet.reg_value[1] = value & 0xff;
packet.len = 7 + 2;
return true;
};
static bool handle_command(SWAP_PACKET& packet) { return false; }
static bool handle_query(SWAP_PACKET& packet) { return false; }
static void update(void) {
uint16_t adc;
ADC10CTL1 = INCH_11 + ADC10SSEL_3;
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON;
ADC10CTL0 |= ENC | ADC10SC;
while (ADC10CTL1 & ADC10BUSY) ;
adc = ADC10MEM;
ADC10CTL0 &= ~ENC;
if (adc >= 0x380) {
ADC10CTL0 |= ENC | REF2_5V | ADC10SC;
while (ADC10CTL1 & ADC10BUSY) ;
adc = ADC10MEM;
ADC10CTL0 &= ~ENC;
value = ((unsigned long) adc * 5L * 125L / 128L);
} else {
value = ((unsigned long) adc * 3L * 125L / 128L);
}
printf<UART>("Voltage: %d\n", value);
ADC10CTL0 &= ~(ADC10ON | REFON);
};
};
template<const uint32_t ID>
uint16_t VOLTAGE_REGISTER_T<ID>::value = 0;
typedef VOLTAGE_REGISTER_T<11> VOLTAGE;
typedef TEMP_HUM_REGISTER_T<12, TIMER, TIMEOUT, DHT_DATA, DHT_POWER> TEMPERATURE_HUMIDITY;
typedef NRF24_T<SPI, CSN, CE, IRQ, MCLK> NRF24;
typedef SWAP_MOTE_T<1, 1, 1, 1, NRF24, 70, CONFIGURATION, VOLTAGE, TEMPERATURE_HUMIDITY> MOTE;
void dump_regs(void)
{
uint8_t regs[64];
NRF24::read_regs(regs);
hex_dump_bytes<UART>(regs, sizeof(regs));
}
int main(void)
{
DCO::init();
ACLK::init();
SMCLK::init();
TIMER::init();
WDT::init();
WDT::enable_irq();
PORT1::init();
PORT2::init();
UART::init();
printf<UART>("Mote example start\n");
SPI::init();
NRF24::init();
MOTE::init();
printf<UART>("Announcing mote\n");
NRF24::start_rx();
TIMEOUT::set(5000);
MOTE::announce<TIMEOUT>();
TIMEOUT::disable();
while (1) {
printf<UART>("Updating registers\n");
MOTE::update_registers();
printf<UART>("Transmitting data\n");
MOTE::transmit_data();
printf<UART>("Sleeping\n");
UART::disable();
TIMEOUT::set(15000);
MOTE::sleep<TIMEOUT>();
TIMEOUT::disable();
UART::enable();
}
return 0;
}
void watchdog_irq(void) __attribute__((interrupt(WDT_VECTOR)));
void watchdog_irq(void)
{
if (TIMEOUT::count_down()) exit_idle();
}
#ifdef __MSP430_HAS_USCI__
void usci_tx_irq(void) __attribute__((interrupt(USCIAB0TX_VECTOR)));
void usci_tx_irq(void)
{
if (SPI::handle_tx_irq() || UART::handle_tx_irq()) exit_idle();
}
void usci_rx_irq(void) __attribute__((interrupt(USCIAB0RX_VECTOR)));
void usci_rx_irq(void)
{
if (SPI::handle_rx_irq() || UART::handle_rx_irq()) exit_idle();
}
#else
void usi_irq(void) __attribute__((interrupt(USI_VECTOR)));
void usi_irq(void)
{
if (SPI::handle_irq()) exit_idle();
}
#endif
| 26.59375
| 94
| 0.717475
|
ekoeppen
|
f40707410b5480f0fe63b4e449861e946f042a25
| 4,599
|
hpp
|
C++
|
include/zisa/reconstruction/cached_local_reconstruction.hpp
|
1uc/ZisaFVM
|
75fcedb3bece66499e011228a39d8a364b50fd74
|
[
"MIT"
] | null | null | null |
include/zisa/reconstruction/cached_local_reconstruction.hpp
|
1uc/ZisaFVM
|
75fcedb3bece66499e011228a39d8a364b50fd74
|
[
"MIT"
] | null | null | null |
include/zisa/reconstruction/cached_local_reconstruction.hpp
|
1uc/ZisaFVM
|
75fcedb3bece66499e011228a39d8a364b50fd74
|
[
"MIT"
] | 1
|
2021-08-24T11:52:51.000Z
|
2021-08-24T11:52:51.000Z
|
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 ETH Zurich, Luc Grosheintz-Laval
#ifndef ZISA_CACHED_LOCAL_RECONSTRUCTION_HPP_ZOQENI
#define ZISA_CACHED_LOCAL_RECONSTRUCTION_HPP_ZOQENI
#include <zisa/grid/grid.hpp>
#include <zisa/memory/array.hpp>
#include <zisa/memory/array_view.hpp>
#include <zisa/model/characteristic_scale.hpp>
#include <zisa/model/euler_variables.hpp>
#include <zisa/model/local_equilibrium.hpp>
#include <zisa/reconstruction/weno_poly.hpp>
namespace zisa {
template <class Equilibrium, class RC, class Scaling>
class CachedLocalReconstruction {
private:
using cvars_t = euler_var_t;
public:
CachedLocalReconstruction() = default;
CachedLocalReconstruction(std::shared_ptr<Grid> grid,
const LocalEquilibrium<Equilibrium> &eq,
const RC &rc,
int_t i_cell,
Scaling scaling)
: grid(grid), eq(eq), rc(rc), i_cell(i_cell), scaling(scaling) {
u_eq_bar = array<cvars_t, 1>(rc.l2g().size());
}
void compute(const array_view<double, 2, row_major> &rhs,
const array_view<WENOPoly, 1> &polys,
const array_view<cvars_t, 1> &u_local) {
if (steps_since_recompute % steps_per_recompute == 0) {
recompute_cache(rhs, polys, u_local);
} else {
const auto &u0 = u_local(int_t(0));
auto [rho, E] = RhoE{u0[0], internal_energy(u0)};
auto [rho_c, E_c] = rhoE_eq_cache(0);
auto elta_rhoE = RhoE{(rho - rho_c) / scale[0],
(E - E_c) / scale[4]};
if (zisa::norm(delta_rhoE) >= recompute_threshold) {
recompute_cache(rhs, polys, u_local);
}
}
auto &l2g = rc.local2global();
for (int_t il = 0; il < l2g.size(); ++il) {
auto [rho_eq_bar, E_eq_bar] = rhoE_eq_cache(il);
u_local(il)[0] -= rho_eq_bar;
u_local(il)[4] -= E_eq_bar;
u_local(il) = u_local(il) / scale;
}
weno_poly = rc.reconstruct(rhs, polys, u_local);
++steps_since_recomputes;
}
void recompute_cache(const array_view<double, 2, row_major> &rhs,
const array_view<WENOPoly, 1> &polys,
const array_view<cvars_t, 1> &u_local) {
const auto &u0 = u_local(int_t(0));
auto rhoE_self = RhoE{u0[0], internal_energy(u0)};
scale = scaling(rhoE_self);
eq.solve(rhoE_self, grid->cells(i_cell));
auto &l2g = rc.local2global();
for (int_t il = 0; il < l2g.size(); ++il) {
rhoE_eq_cache(il) = eq.extrapolate(grid->cells(l2g[il]));
}
steps_since_recompute = 0;
}
void compute_tracer(const array_view<double, 2, row_major> &rhs,
const array_view<ScalarPoly, 1> &polys,
const array_view<double, 2, column_major> &q_local) {
auto n_vars = q_local.shape(1);
if (scalar_polys.size() != n_vars) {
scalar_polys = array<ScalarPoly, 1>(n_vars);
}
auto rhs_view = [&]() {
auto shape = shape_t<2>{rhs.shape(0), 1};
return array_view<double, 2, row_major>(shape, rhs.raw());
}();
for (int_t k_var = 0; k_var < n_vars; ++k_var) {
auto q_component = array_const_view<double, 1>(
shape_t<1>(q_local.shape(0)),
q_local.raw() + k_var * q_local.shape(0));
scalar_polys[k_var] = rc.reconstruct(rhs_view, polys, q_component);
}
}
cvars_t operator()(const XYZ &x) const {
return cvars_t(background(x) + delta(x));
}
double tracer(const XYZ &x, int_t k_var) const {
return scalar_polys[k_var](x)[0];
}
cvars_t delta(const XYZ &x) const { return cvars_t(scale * weno_poly(x)); }
cvars_t background(const XYZ &x) const {
auto [rho, E] = eq.extrapolate(x);
return cvars_t{rho, 0.0, 0.0, 0.0, E};
}
auto combined_stencil_size() const
-> decltype(std::declval<RC>().combined_stencil_size()) {
return rc.combined_stencil_size();
}
auto local2global() const -> decltype(std::declval<RC>().local2global()) {
return rc.local2global();
}
std::string str(int verbose = 0) const {
std::stringstream ss;
ss << grid->str() << "\n";
ss << eq.str(verbose) << "\n";
ss << rc.str(verbose) << "\n";
return ss.str();
}
private:
std::shared_ptr<Grid> grid;
LocalEquilibrium<Equilibrium> eq;
array<cvars_t, 1> rhoE_eq_cache;
int_t steps_since_recompute;
int_t steps_per_recompute;
double recompute_threshold;
RC rc;
int_t i_cell;
WENOPoly weno_poly;
array<ScalarPoly, 1> scalar_polys;
Scaling scaling;
cvars_t scale = cvars_t::zeros();
};
} // namespace zisa
#endif /* end of include guard */
| 28.565217
| 77
| 0.630354
|
1uc
|
f40712521dd933d041417bc7dd64cd6ceecebb1e
| 1,046
|
cpp
|
C++
|
src/pointcloud_publisher.cpp
|
DavidMerzJr/ros-cognex-demo
|
818572cc4a2f36e8afdc221c287c83a31f3031b7
|
[
"Apache-2.0"
] | 1
|
2021-06-21T23:01:41.000Z
|
2021-06-21T23:01:41.000Z
|
src/pointcloud_publisher.cpp
|
DavidMerzJr/ros-cognex-demo
|
818572cc4a2f36e8afdc221c287c83a31f3031b7
|
[
"Apache-2.0"
] | null | null | null |
src/pointcloud_publisher.cpp
|
DavidMerzJr/ros-cognex-demo
|
818572cc4a2f36e8afdc221c287c83a31f3031b7
|
[
"Apache-2.0"
] | 2
|
2021-06-24T00:30:39.000Z
|
2021-09-27T07:40:23.000Z
|
#include <string>
#include <pcl/io/ply_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl_ros/point_cloud.h>
#include <ros/package.h>
#include <ros/ros.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "pointcloud_publisher");
ros::NodeHandle nh;
// Get parameters
std::string filename, frame;
nh.getParam("pointcloud_file", filename);
nh.getParam("pointcloud_frame", frame);
// Load the pointcloud
pcl::PointCloud<pcl::PointXYZRGB> cloud;
pcl::PLYReader file_loader;
file_loader.read(filename, cloud);
cloud.header.frame_id = frame;
for (pcl::PointXYZRGB& p : cloud)
{
p.x /= 1000;
p.y /= 1000;
p.z /= 1000;
}
// Make a publisher
ros::Publisher pub = nh.advertise<pcl::PointCloud<pcl::PointXYZRGB>>("point_cloud", 1, true);
// // Re-publish occasionally in case the frame moves
// ros::Rate loop_rate(0.01);
// while (ros::ok())
// {
pub.publish(cloud);
// ros::spinOnce();
// loop_rate.sleep();
// }
ros::spin();
return 0;
}
| 21.791667
| 95
| 0.646272
|
DavidMerzJr
|
f40ca280bdb514c3cef821796be2c049c7f5dada
| 1,184
|
hpp
|
C++
|
src/libv/lma/time/time.hpp
|
bezout/LMA
|
9555e41eed5f44690c5f6e3ea2d22d520ff1a9d2
|
[
"BSL-1.0"
] | 29
|
2015-12-08T12:07:30.000Z
|
2022-01-08T21:23:01.000Z
|
src/libv/lma/time/time.hpp
|
ayumizll/LMA
|
e945452e12a8b05bd17400b46a20a5322aeda01d
|
[
"BSL-1.0"
] | 3
|
2016-07-11T16:23:48.000Z
|
2017-04-05T13:33:00.000Z
|
src/libv/lma/time/time.hpp
|
bezout/LMA
|
9555e41eed5f44690c5f6e3ea2d22d520ff1a9d2
|
[
"BSL-1.0"
] | 8
|
2015-12-21T01:52:27.000Z
|
2017-12-26T02:26:55.000Z
|
/**
\file
\author Datta Ramadasan
//==============================================================================
// Copyright 2015 INSTITUT PASCAL UMR 6602 CNRS/Univ. Clermont II
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
*/
#ifndef __UTILS_SRC_TIME_TIME_HPP__
#define __UTILS_SRC_TIME_TIME_HPP__
#include <stdlib.h>
#include <ctime>
#ifndef WIN32
#include <sys/time.h>
#endif
#include <iostream>
#include <vector>
#include <libv/core/time.hpp>
namespace utils {
//************************
//! Cette fonction lit le nombre de cycle processeur
//************************
static inline double read_cycles() {
size_t hi, lo;
//__asm __volatile ("rdtsc" : "=a" (lo), "=d" (hi));
return double((long long)hi << 32 | lo);
}
static inline double now() {
return v::now();
// struct timeval tp;
// gettimeofday(&tp,NULL);
// return double(tp.tv_sec) + double(tp.tv_usec)*1e-6;
}
}//! eon utils
#endif // TIME_HPP
| 25.191489
| 80
| 0.533784
|
bezout
|
f40f097472cfe7f26e7bc6099cc0492be03e5d16
| 2,284
|
cpp
|
C++
|
ui/src/ui_save_recall.cpp
|
starlingcode/via_archive
|
e83f5178529664e4c348f3c2a30d923eafa7f896
|
[
"MIT"
] | 3
|
2017-09-15T13:38:01.000Z
|
2018-03-20T03:30:48.000Z
|
ui/src/ui_save_recall.cpp
|
starlingcode/via_archive
|
e83f5178529664e4c348f3c2a30d923eafa7f896
|
[
"MIT"
] | null | null | null |
ui/src/ui_save_recall.cpp
|
starlingcode/via_archive
|
e83f5178529664e4c348f3c2a30d923eafa7f896
|
[
"MIT"
] | null | null | null |
/*
* ViaUI::save_recall.cpp
*
* Created on: Sep 11, 2018
* Author: willmitchell
*/
#include "user_interface.hpp"
/*
*
* Template routine for the UI state machine.
* Assign the button pointers to the address of the sensor state variables.
* Initialize the eeprom and read the last saved mode set.
* Initialize those modes
* Set the UI state default
*
*/
void ViaUI::initialize(void) {
#ifdef BUILD_F373
button1 = (int32_t *) &BUTTON1SENSOR;
button2 = (int32_t *) &BUTTON2SENSOR;
button3 = (int32_t *) &BUTTON3SENSOR;
button4 = (int32_t *) &BUTTON4SENSOR;
button5 = (int32_t *) &BUTTON5SENSOR;
button6 = (int32_t *) &BUTTON6SENSOR;
#endif
state = &ViaUI::defaultMenu;
transition(&ViaUI::defaultMenu);
}
void ViaUI::loadFromEEPROM(int32_t position) {
loadStateFromMemory(position);
button1Mode = modeStateBuffer & BUTTON1_MASK;
button2Mode = (modeStateBuffer & BUTTON2_MASK) >> BUTTON2_SHIFT;
button3Mode = (modeStateBuffer & BUTTON3_MASK) >> BUTTON3_SHIFT;
button4Mode = (modeStateBuffer & BUTTON4_MASK) >> BUTTON4_SHIFT;
button5Mode = (modeStateBuffer & BUTTON5_MASK) >> BUTTON5_SHIFT;
button6Mode = (modeStateBuffer & BUTTON6_MASK) >> BUTTON6_SHIFT;
aux1Mode = (modeStateBuffer & AUX_MODE1_MASK) >> AUX_MODE1_SHIFT;
aux2Mode = (modeStateBuffer & AUX_MODE2_MASK) >> AUX_MODE2_SHIFT;
aux3Mode = (modeStateBuffer & AUX_MODE3_MASK) >> AUX_MODE3_SHIFT;
aux4Mode = (modeStateBuffer & AUX_MODE4_MASK) >> AUX_MODE4_SHIFT;
}
// writes 2 16-bit values representing the modeStateBuffer word to EEPROM at the specified position, 1 runtime + 6 presets + calibration word
void ViaUI::storeStateToEEPROM(int32_t position) {
#ifdef BUILD_F373
eepromStatus = EE_WriteVariable(VirtAddVarTab[position * 2],
(uint16_t) modeStateBuffer);
eepromStatus |= EE_WriteVariable(VirtAddVarTab[(position * 2) + 1],
(uint16_t) (modeStateBuffer >> 16));
#endif
}
// writes 2 16-bit values representing the data word to EEPROM per position, 1 runtime + 6 presets + calibration word
void ViaUI::storeToEEPROM(int32_t position, uint32_t data) {
#ifdef BUILD_F373
eepromStatus = EE_WriteVariable(VirtAddVarTab[position * 2],
(uint16_t) data);
eepromStatus |= EE_WriteVariable(VirtAddVarTab[(position * 2) + 1],
(uint16_t) (data >> 16));
#endif
}
| 29.282051
| 142
| 0.739054
|
starlingcode
|
f411662fbd7ae2c91da0a10e09fb1f2c4c7c9b2f
| 5,410
|
cpp
|
C++
|
src/step2lon.cpp
|
whulizhen/iers2010
|
3b1c9587510074a7658e0042ce6b1e737560ca23
|
[
"WTFPL"
] | null | null | null |
src/step2lon.cpp
|
whulizhen/iers2010
|
3b1c9587510074a7658e0042ce6b1e737560ca23
|
[
"WTFPL"
] | null | null | null |
src/step2lon.cpp
|
whulizhen/iers2010
|
3b1c9587510074a7658e0042ce6b1e737560ca23
|
[
"WTFPL"
] | 2
|
2017-08-01T22:01:45.000Z
|
2018-10-13T09:06:04.000Z
|
#include "dehanttideinel.hpp"
/**
* @details This function gives the in-phase and out-of-phase corrections
* induced by mantle anelasticity in the long period band.
* This function is a translation/wrapper for the fortran STEP2LON
* subroutine, found here :
* http://maia.usno.navy.mil/conv2010/software.html
*
* @param[in] xsta Geocentric position of the IGS station (Note 1)
* @param[in] t Centuries since J2000
* @param[out] xcorsta In phase and out of phase station corrections
* for diurnal band (Note 2)
*
* @note
* -# The IGS station is in ITRF co-rotating frame. All coordinates are
* expressed in meters, as arrays, i.e. [x,y,z].
* -# All coordinates are expressed in meters.
* -# Status: Class 1
* -# This fucnction is part of the package dehanttideinel, see
* ftp://maia.usno.navy.mil/conv2010/convupdt/chapter7/dehanttideinel/
*
* @verbatim
* Test case:
* given input: XSTA(1) = 4075578.385D0 meters
* XSTA(2) = 931852.890D0 meters
* XSTA(3) = 4801570.154D0 meters
* T = 0.1059411362080767D0 Julian centuries
*
* expected output: XCORSTA(1) = -0.9780962849562107762D-04 meters
* XCORSTA(2) = -0.2236349699932734273D-04 meters
* XCORSTA(3) = 0.3561945821351565926D-03 meters
* @endverbatim
*
* @version 2010 October 20
*
* @cite iers2010,
* Mathews, P. M., Dehant, V., and Gipson, J. M., 1997, "Tidal station
* displacements," J. Geophys. Res., 102(B9), pp. 20,469-20,477,
*
*/
void iers2010::dtel::step2lon (const double* xsta,const double& t,
double* xcorsta)
{
// Set constants
#ifdef USE_EXTERNAL_CONSTS
/*constexpr double TWOPI (D2PI);*/
#else
constexpr double D2PI ( 6.283185307179586476925287e0 );// 2*pi
constexpr double DEG2RAD( D2PI / 360e0 ); // degrees to radians
#endif
static const double datdi[][9] = {
{0e0, 0e0, 0e0, 1e0, 0e0, 0.47e0, 0.23e0, 0.16e0, 0.07e0},
{0e0, 2e0, 0e0, 0e0, 0e0, -0.20e0,-0.12e0,-0.11e0,-0.05e0},
{1e0, 0e0,-1e0, 0e0, 0e0, -0.11e0,-0.08e0,-0.09e0,-0.04e0},
{2e0, 0e0, 0e0, 0e0, 0e0, -0.13e0,-0.11e0,-0.15e0,-0.07e0},
{2e0, 0e0, 0e0, 1e0, 0e0, -0.05e0,-0.05e0,-0.06e0,-0.03e0}
};
// Compute the phase angles in degrees.
double s ( 218.31664563e0
+ (481267.88194e0
+ (-0.0014663889e0
+ (0.00000185139e0)*t)*t)*t
);
double pr ( (1.396971278e0
+ (0.000308889e0
+ (0.000000021e0
+ (0.000000007e0)*t)*t)*t)*t
);
s += pr;
double h ( 280.46645e0
+ (36000.7697489e0
+ (0.00030322222e0
+ (0.000000020e0
+ (-0.00000000654e0)*t)*t)*t)*t
);
double p ( 83.35324312e0
+ (4069.01363525e0
+ (-0.01032172222e0
+ (-0.0000124991e0
+ (0.00000005263e0)*t)*t)*t)*t
);
double zns ( 234.95544499e0
+ (1934.13626197e0
+ (-0.00207561111e0
+ (-0.00000213944e0
+ (0.00000001650e0)*t)*t)*t)*t
);
double ps ( 282.93734098e0
+ (1.71945766667e0
+ (0.00045688889e0
+ (-0.00000001778e0
+ (-0.00000000334e0)*t)*t)*t)*t
);
// Reduce angles to between the range 0 and 360.
s = fmod(s,360e0);
h = fmod(h,360e0);
p = fmod(p,360e0);
zns = fmod(zns,360e0);
ps = fmod(ps,360e0);
double rsta ( ::sqrt ( std::inner_product (xsta,xsta+3,xsta,.0e0) ) );
double sinphi ( xsta[2] / rsta );
double cosphi ( ::sqrt ( xsta[0]*xsta[0] + xsta[1]*xsta[1] ) / rsta );
double cosla ( xsta[0] / cosphi / rsta );
double sinla ( xsta[1] / cosphi / rsta );
double dr_tot (.0e0), dn_tot (.0e0);
for (int i=0;i<3;i++)
xcorsta[i] = .0e0;
for (int j=0;j<5;j++) {
double thetaf ( (datdi[j][0]*s+datdi[j][1]*h+datdi[j][2]*p+
datdi[j][3]*zns+datdi[j][4]*ps)*DEG2RAD );
double dr ( datdi[j][5]*(3e0*sinphi*sinphi-1e0)/2e0*cos(thetaf)+
datdi[j][7]*(3e0*sinphi*sinphi-1e0)/2e0*sin(thetaf) );
double dn ( datdi[j][6]*(cosphi*sinphi*2e0)*cos(thetaf)+
datdi[j][8]*(cosphi*sinphi*2e0)*sin(thetaf) );
double de ( 0e0 );
dr_tot += dr;
dn_tot += dn;
xcorsta[0] += dr*cosla*cosphi-de*sinla-dn*sinphi*cosla;
xcorsta[1] += dr*sinla*cosphi+de*cosla-dn*sinphi*sinla;
xcorsta[2] += dr*sinphi+dn*cosphi;
}
for (int i=0;i<3;i++)
xcorsta[i] /= 1000e0;
// Finished.
return;
}
/*
#include <stdio.h>
int main ()
{
double xsta[] = {4075578.385e0,931852.890e0,4801570.154e0};
double t = 0.1059411362080767e0;
double xcorsta[3] = {.0e0,.0e0,.0e0};
step2lon ( xsta,t,xcorsta );
printf ("\nSubroutine STEP2LON");
printf ("\nDifferences in meters:");
printf ("\n\t|dx| = %15.12f",-0.9780962849562107762e-04 -xcorsta[0]);
printf ("\n\t|dy| = %15.12f",-0.2236349699932734273e-04 -xcorsta[1]);
printf ("\n\t|dz| = %15.12f",0.3561945821351565926e-03 -xcorsta[2]);
printf ("\n");
return 0;
}
*/
| 31.823529
| 86
| 0.543623
|
whulizhen
|
f414799cc9ae602c28104555cbd7a8a1f217a978
| 1,676
|
cpp
|
C++
|
Real Gas Equation/Peng Robinson.cpp
|
ArcFlux/Numerical-Method
|
3e34eac71577ed4ddb2ab810ded45cff56d810f6
|
[
"MIT"
] | null | null | null |
Real Gas Equation/Peng Robinson.cpp
|
ArcFlux/Numerical-Method
|
3e34eac71577ed4ddb2ab810ded45cff56d810f6
|
[
"MIT"
] | null | null | null |
Real Gas Equation/Peng Robinson.cpp
|
ArcFlux/Numerical-Method
|
3e34eac71577ed4ddb2ab810ded45cff56d810f6
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <conio.h>
#include <math.h>
using namespace std;
double PR(double x, double b, double a, double al, double P, double R, double T){
return R*T/(x-b)-(a*al/(x*(x+b)+b*(x-b)))-P;
}
double dfun(double x, double h, double b, double a, double al, double P, double R, double T){
return (PR(x+h, b, a, al, P, R, T)-PR(x, b, a, al, P, R, T))/h;
}
int main(){
int i, lim, n, r;
float l;
double x, xm, d, h, xr, xx;
double a, b, al, k, Tr;
double R=8.314, P, T, Pc, Tc, w;
cout<<"=====PENG ROBINSON EQUATION [Vm]====="<<endl;
//INPUT
cout<<"P[kPa] : ", cin>>P;
cout<<"T[K] : ", cin>>T;
cout<<"Pc[kPa]: ", cin>>Pc;
cout<<"Tc[K] : ", cin>>Tc;
cout<<"w : ", cin>>w;
cout<<"==Nilai x awal : ", cin>>x;
cout<<"==Nilai x akhir: ", cin>>r;
d=0.00001, h=0.00001, lim=100, l=0.1;
//EARLY CALC
Tr=T/Tc;
a=0.45724*pow(R,2)*pow(Tc,2)/Pc;
b=0.07780*R*Tc/Pc;
k=0.37464+1.54226*w-0.26992*pow(w,2);
al=pow(1+k*(1-pow(Tr,0.5)),2);
cout<<"Tr= "<<Tr<<endl;
cout<<"a = "<<a<<endl;
cout<<"b = "<<b<<endl;
cout<<"k = "<<k<<endl;
cout<<"al= "<<al<<endl;
cout<<"====================================="<<endl;
for(n=0; x<=r; n++){
xr=x;
for(i=1; fabs(PR(xr, b, a, al, P, R, T))>=d && i<=lim; i++){
xm = xr - PR(xr, b, a, al, P, R, T)/dfun(xr, h, b, a, al, P, R, T);
xr = xm;
}
if(n==0 && fabs(PR(xm, b, a, al, P, R, T))<=d){
cout<<"Vm: ", printf("%.5lf",xm), cout<<" L/mol"<<endl;
xx = xm;
}else if(n!=0 && fabs(PR(xm, b, a, al, P, R, T))<=d && fabs(xx-xm)>0.1){
cout<<"Vm: ", printf("%.5lf",xm), cout<<" L/mol"<<endl;
xx = xm;
}
x=x+l;
}
return 0;
}
| 28.40678
| 94
| 0.47673
|
ArcFlux
|
f416a7ae0257bc3b77bf66b1b54c01a4ebf8ab6b
| 361
|
hpp
|
C++
|
NativePlugin/CaptainAsteroid/src/physics/systems/ReduceLifeTime.hpp
|
axoloto/CaptainAsteroid
|
fcdcb6bc6987ecf53226daa7027116e40d74401a
|
[
"Apache-2.0"
] | null | null | null |
NativePlugin/CaptainAsteroid/src/physics/systems/ReduceLifeTime.hpp
|
axoloto/CaptainAsteroid
|
fcdcb6bc6987ecf53226daa7027116e40d74401a
|
[
"Apache-2.0"
] | null | null | null |
NativePlugin/CaptainAsteroid/src/physics/systems/ReduceLifeTime.hpp
|
axoloto/CaptainAsteroid
|
fcdcb6bc6987ecf53226daa7027116e40d74401a
|
[
"Apache-2.0"
] | null | null | null |
#pragma once
#include "entityx/System.h"
namespace CaptainAsteroidCPP
{
namespace Sys
{
class ReduceLifeTime : public entityx::System<ReduceLifeTime>
{
public:
ReduceLifeTime() = default;
void update(entityx::EntityManager &entities,
entityx::EventManager &events,
double dt);
};
}// namespace Sys
}// namespace CaptainAsteroidCPP
| 19
| 63
| 0.717452
|
axoloto
|
f4197047faf6ee21fbf039cf534938f0c1b6b309
| 4,100
|
cpp
|
C++
|
source/sill/components/ui-select-component.cpp
|
Breush/lava
|
1b1b1f0785300b93b4a9f35fca4490502fea6552
|
[
"MIT"
] | 15
|
2018-02-26T08:20:03.000Z
|
2022-03-06T03:25:46.000Z
|
source/sill/components/ui-select-component.cpp
|
Breush/lava
|
1b1b1f0785300b93b4a9f35fca4490502fea6552
|
[
"MIT"
] | 32
|
2018-02-26T08:26:38.000Z
|
2020-09-12T17:09:38.000Z
|
source/sill/components/ui-select-component.cpp
|
Breush/lava
|
1b1b1f0785300b93b4a9f35fca4490502fea6552
|
[
"MIT"
] | null | null | null |
#include <lava/sill/components/ui-select-component.hpp>
#include <lava/sill/components/flat-component.hpp>
#include <lava/sill/components/transform-component.hpp>
#include <lava/sill/game-engine.hpp>
#include <lava/sill/entity.hpp>
#include <lava/sill/makers/quad-flat.hpp>
#include <lava/sill/makers/text-flat.hpp>
using namespace lava::sill;
UiSelectComponent::UiSelectComponent(Entity& entity)
: UiSelectComponent(entity, {}, 0xFF)
{
}
UiSelectComponent::UiSelectComponent(Entity& entity, std::vector<u8string> options, uint8_t index)
: IUiComponent(entity)
, m_flatComponent(entity.ensure<FlatComponent>())
, m_options(std::move(options))
, m_index(index)
{
auto& scene2d = entity.engine().scene2d();
m_extent = {300.f, m_fontSize};
m_hoveringExtent = m_extent;
// Background setup
{
auto& node = makers::quadFlatMaker(1.f)(m_flatComponent);
node.name = "background";
node.flatGroup->primitive(0u).material(scene2d.makeMaterial("ui.quad"));
node.transform(glm::scale(glm::mat3(1.f), m_extent));
}
m_textDirty = (m_index != 0xFF);
}
void UiSelectComponent::update(float /* dt */)
{
if (m_textDirty) {
updateText();
}
}
// ----- IUiComponent
void UiSelectComponent::hovered(bool hovered)
{
if (m_hovered == hovered) return;
m_hovered = hovered;
m_hoveringExtent = m_extent;
m_hoveringOffset = glm::vec2(0.f);
if (m_hovered) {
m_hoveringExtent.y = (m_options.size() + 1) * m_fontSize;
m_hoveringOffset.y = m_options.size() * m_fontSize / 2.f;
}
updateHovered();
}
void UiSelectComponent::dragEnd(const glm::ivec2& mousePosition)
{
m_beingClicked = false;
if (checkHovered(mousePosition)) {
auto position = topLeftRelativePosition(mousePosition);
auto clickedRow = static_cast<uint8_t>(position.y / m_fontSize);
if (clickedRow > m_options.size()) {
clickedRow = static_cast<uint8_t>(m_options.size());
}
if (clickedRow > 0) {
hovered(false);
if (m_index != clickedRow - 1u) {
m_index = clickedRow - 1u;
updateText();
for (const auto& callback : m_indexChangedCallbacks) {
callback(m_index, m_options[m_index]);
}
}
}
}
}
// ----- Internal
void UiSelectComponent::updateText()
{
m_flatComponent.removeNode("text");
m_textDirty = false;
if (m_index == 0xFF) return;
const auto& text = m_options[m_index];
if (!text.empty()) {
makers::TextFlatOptions options;
options.fontSize = m_fontSize;
options.anchor = Anchor::Left;
auto& node = makers::textFlatMaker(text, options)(m_flatComponent);
node.transform(glm::translate(glm::mat3(1.f), {-m_extent.x / 2.f + m_horizontalPadding, 0.f}));
node.name = "text";
}
}
void UiSelectComponent::updateHovered()
{
if (m_beingClicked) return;
m_flatComponent.removeNode("options-background");
m_flatComponent.removeNodes("options-text");
if (!m_hovered || m_options.empty()) return;
auto& scene2d = m_entity.engine().scene2d();
// Background setup
{
auto& node = makers::quadFlatMaker(1.f)(m_flatComponent);
node.name = "options-background";
node.flatGroup->primitive(0u).material(scene2d.makeMaterial("ui.quad"));
auto yOffset = (m_options.size() + 1u) * m_fontSize / 2.f;
node.transform(glm::scale(glm::translate(glm::mat3(1.f), {0.f, yOffset}), {m_extent.x, m_options.size() * m_fontSize}));
}
// Texts
for (auto i = 0u; i < m_options.size(); ++i) {
const auto& text = m_options[i];
makers::TextFlatOptions options;
options.fontSize = m_fontSize;
options.anchor = Anchor::Left;
auto& node = makers::textFlatMaker(text, options)(m_flatComponent);
node.transform(glm::translate(glm::mat3(1.f), {-m_extent.x / 2.f + m_horizontalPadding, (i + 1) * m_fontSize}));
node.name = "options-text";
}
}
| 29.078014
| 128
| 0.632439
|
Breush
|
f420a66180d32ae4bb81e0c288c63a29305baa8c
| 1,183
|
cpp
|
C++
|
01. Easy/03. Linked_List/06. Linked_List_Cycle.cpp
|
premnaaath/leetcode-TIQ
|
90f9d7216b596dc42fe0d559f3ecdaa448b258d1
|
[
"MIT"
] | null | null | null |
01. Easy/03. Linked_List/06. Linked_List_Cycle.cpp
|
premnaaath/leetcode-TIQ
|
90f9d7216b596dc42fe0d559f3ecdaa448b258d1
|
[
"MIT"
] | null | null | null |
01. Easy/03. Linked_List/06. Linked_List_Cycle.cpp
|
premnaaath/leetcode-TIQ
|
90f9d7216b596dc42fe0d559f3ecdaa448b258d1
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
ListNode() : next(NULL) {}
};
void Insert(ListNode *head, int val)
{
ListNode *temp = new ListNode(val);
if (!head)
{
head = temp;
return;
}
ListNode *t = head;
while (t->next)
t = t->next;
t->next = temp;
}
bool hasCycle(ListNode *head)
{
if (!head or !head->next)
return false;
ListNode *p{head->next->next}, *q{head->next};
while (p != q and p and p->next)
{
p = p->next->next;
q = q->next;
}
if (p == q)
return true;
return false;
}
void solve()
{
vector<int> vec{};
ListNode *head = new ListNode;
for (auto i : vec)
Insert(head, i);
ListNode *temp = head;
while (temp->next)
temp = temp->next;
temp->next = head->next;
string res = hasCycle(head) == true ? "True\n" : "False\n";
cout << res;
}
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t{1};
// cin >> t;
while (t--)
solve();
return 0;
}
| 18.2
| 63
| 0.519019
|
premnaaath
|
f4224e1045fd368244db7ee504b7f28695695c01
| 5,322
|
cpp
|
C++
|
rosbag2_extensions_examples/src/sample_node.cpp
|
qetuo1098/rosbag2
|
2798428a1d542a75176c34a88db1b56206bb1a66
|
[
"Apache-2.0"
] | null | null | null |
rosbag2_extensions_examples/src/sample_node.cpp
|
qetuo1098/rosbag2
|
2798428a1d542a75176c34a88db1b56206bb1a66
|
[
"Apache-2.0"
] | null | null | null |
rosbag2_extensions_examples/src/sample_node.cpp
|
qetuo1098/rosbag2
|
2798428a1d542a75176c34a88db1b56206bb1a66
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include "rclcpp/serialization.hpp"
#include "rclcpp/serialized_message.hpp"
#include "rcpputils/filesystem_helper.hpp"
#include "rcutils/time.h"
#include "rosbag2_cpp/reader.hpp"
#include "rosbag2_cpp/readers/sequential_reader.hpp"
#include "rosbag2_cpp/readers/random_access_reader.hpp"
#include "rosbag2_cpp/writer.hpp"
#include "rosbag2_cpp/writers/sequential_writer.hpp"
#include "test_msgs/msg/basic_types.hpp"
int main()
{
std::cout << "Use sample_node_2 instead" << std::endl;
return 0;
using TestMsgT = test_msgs::msg::BasicTypes;
TestMsgT test_msg;
rclcpp::Serialization<TestMsgT> serialization;
rclcpp::SerializedMessage serialized_msg;
// test_msg.float64_value = 12345.6789;
// serialization.serialize_message(&test_msg, &serialized_msg);
// TestMsgT test_msg2;
// test_msg2.float64_value = 98765.4321;
// rclcpp::SerializedMessage serialized_msg2;
// serialization.serialize_message(&test_msg2, &serialized_msg2);
auto rosbag_directory = rcpputils::fs::path("test_rosbag2_writer_api_bag");
// in case the bag was previously not cleaned up
rcpputils::fs::remove_all(rosbag_directory);
// See https://github.com/ros2/rosbag2/issues/448
rcpputils::fs::create_directories(rosbag_directory);
rosbag2_cpp::StorageOptions storage_options;
storage_options.uri = rosbag_directory.string();
storage_options.storage_id = "sqlite3";
storage_options.max_bagfile_size = 0; // default
storage_options.max_cache_size = 0; // default
rosbag2_cpp::ConverterOptions converter_options;
converter_options.input_serialization_format = "cdr";
converter_options.output_serialization_format = "cdr";
// writing data to bag
std::cout << "Writing data to bag" << std::endl;
{
rosbag2_cpp::Writer writer(std::make_unique<rosbag2_cpp::writers::SequentialWriter>());
writer.open(storage_options, converter_options);
rosbag2_storage::TopicMetadata tm;
tm.name = "/my/test/topic";
tm.type = "test_msgs/msg/BasicTypes";
tm.serialization_format = "cdr";
writer.create_topic(tm);
for (int i=1; i<=10; i++) {
auto bag_message = std::make_shared<rosbag2_storage::SerializedBagMessage>();
auto ret = rcutils_system_time_now(&bag_message->time_stamp);
if (ret != RCL_RET_OK) {
throw std::runtime_error("couldn't assign time rosbag message");
}
bag_message->topic_name = tm.name;
test_msg.float64_value = i*10;
serialization.serialize_message(&test_msg, &serialized_msg);
bag_message->serialized_data = std::shared_ptr<rcutils_uint8_array_t>(
&serialized_msg.get_rcl_serialized_message(), [](rcutils_uint8_array_t * /* data */) {});
writer.write(bag_message);
}
// writer close on scope exit
}
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
std::cout << "Reading the bag sequentially (starting from index 1)" << std::endl;
// Read the bag sequentially
{
rosbag2_cpp::Reader reader(std::make_unique<rosbag2_cpp::readers::SequentialReader>());
reader.open(storage_options, converter_options);
while (reader.has_next()) {
auto bag_message = reader.read_next();
TestMsgT extracted_test_msg;
rclcpp::SerializedMessage extracted_serialized_msg(*bag_message->serialized_data);
serialization.deserialize_message(
&extracted_serialized_msg, &extracted_test_msg);
std::cout << extracted_test_msg.float64_value << std::endl;
}
// reader closes on scope exit
}
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
std::cout << "Randomly accessing messages in the bag at indices: {3, 6, 2, 1, 10}" << std::endl;
// Randomly access a few indices
{
rosbag2_cpp::readers::RandomAccessReader reader;
reader.open(storage_options, converter_options);
int indices [] = {3, 6, 2, 1, 10};
for (int i : indices) {
auto bag_message = reader.read_at_index(i);
TestMsgT extracted_test_msg;
rclcpp::SerializedMessage extracted_serialized_msg(*bag_message->serialized_data);
serialization.deserialize_message(
&extracted_serialized_msg, &extracted_test_msg);
std::cout << extracted_test_msg.float64_value << std::endl;
}
// reader closes on scope exit
}
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
std::cout << "Randomly accessing messages between indices 3 and 10" << std::endl;
// Randomly access a few indices
{
rosbag2_cpp::readers::RandomAccessReader reader;
reader.open(storage_options, converter_options);
int index_begin = 3;
int index_end = 10;
auto bag_message_vector = reader.read_at_index_range(index_begin, index_end);
std::cout << "Number of messages: " << bag_message_vector->size() << std::endl;
for (auto bag_message : *bag_message_vector) {
TestMsgT extracted_test_msg;
rclcpp::SerializedMessage extracted_serialized_msg(*bag_message->serialized_data);
serialization.deserialize_message(
&extracted_serialized_msg, &extracted_test_msg);
std::cout << extracted_test_msg.float64_value << std::endl;
}
// reader closes on scope exit
}
// remove the rosbag again after the test
rcpputils::fs::remove_all(rosbag_directory);
}
| 35.48
| 98
| 0.704247
|
qetuo1098
|
f4262167959e3aade709dd57a9f3ce9bceaa952b
| 2,281
|
cpp
|
C++
|
pMarker/dockform.cpp
|
liuwons/pMarker
|
f0db49cd215383796957e9e7c192b8cb358c9e4e
|
[
"Apache-2.0"
] | 1
|
2016-12-20T10:13:53.000Z
|
2016-12-20T10:13:53.000Z
|
pMarker/dockform.cpp
|
liuwons/pMarker
|
f0db49cd215383796957e9e7c192b8cb358c9e4e
|
[
"Apache-2.0"
] | null | null | null |
pMarker/dockform.cpp
|
liuwons/pMarker
|
f0db49cd215383796957e9e7c192b8cb358c9e4e
|
[
"Apache-2.0"
] | null | null | null |
#include "dockform.h"
DockForm::DockForm(QWidget *parent) :
QWidget(parent)
{
mainLayout = new QVBoxLayout;
preview_img = new Preview(*screen_size, Preview::PREVIEW_OVERALL);
preview_mrk = new Preview(*screen_size, Preview::PREVIEW_PART);
preview_img->setMaximumHeight(screen_size->width() / 8);
preview_img->setMaximumWidth(screen_size->width() / 8);
preview_mrk->setMaximumHeight(screen_size->width() / 8);
preview_mrk->setMaximumWidth(screen_size->width() / 8);
preview_img->setMinimumSize(screen_size->width() / 8, screen_size->width() / 8);
preview_mrk->setMinimumSize(screen_size->width() / 8, screen_size->width() / 8);
tb_next = new QToolButton;
tb_next->setIcon(QIcon("res/playnext3.png"));
tb_next->setIconSize(QSize(48,48));
tb_next->setAutoRaise(true);
tb_prev = new QToolButton;
tb_prev->setIcon(QIcon("res/playprev3.png"));
tb_prev->setIconSize(QSize(48,48));
tb_prev->setAutoRaise(true);
tb_write = new QToolButton;
tb_write->setIcon(QIcon("res/write.png"));
tb_write->setIconSize(QSize(48,48));
tb_write->setAutoRaise(true);
lyt_tools = new QHBoxLayout;
lyt_tools->addWidget(tb_prev);
lyt_tools->addWidget(tb_write);
lyt_tools->addWidget(tb_next);
/*
tb_next2 = new QToolButton;
tb_next2->setIcon(QIcon("res/Arrows-Right-round-icon.png"));
tb_next2->setIconSize(QSize(48,48));
tb_next2->setAutoRaise(true);
tb_prev2 = new QToolButton;
tb_prev2->setIcon(QIcon("res/Arrows-left-round-icon.png"));
tb_prev2->setIconSize(QSize(48,48));
tb_prev2->setAutoRaise(true);
tb_cut = new QToolButton;
tb_cut->setIcon(QIcon("res/cut.png"));
tb_cut->setIconSize(QSize(48,48));
tb_cut->setAutoRaise(true);
lyt_tools2 = new QHBoxLayout;
lyt_tools2->addWidget(tb_prev2);
lyt_tools2->addWidget(tb_cut);
lyt_tools2->addWidget(tb_next2);*/
mainLayout->addWidget(preview_img);
mainLayout->addLayout(lyt_tools);
mainLayout->addWidget(preview_mrk);
//mainLayout->addLayout(lyt_tools2);
setLayout(mainLayout);
}
DockForm::~DockForm()
{
if(preview_img != 0)
delete preview_img;
if(preview_mrk != 0)
delete preview_mrk;
if(mainLayout != 0)
delete mainLayout;
}
| 33.057971
| 84
| 0.68961
|
liuwons
|
f4292c6daefcb862286f47b58b7c75782f8722f2
| 9,625
|
cpp
|
C++
|
QSidePanel/QSidePanel/SidePanel.cpp
|
inobelar/QSidePanel
|
4554e1bcd3f0942df66ed1357cdac7afdd08597d
|
[
"MIT"
] | 16
|
2019-10-11T12:08:05.000Z
|
2022-01-02T05:59:16.000Z
|
QSidePanel/QSidePanel/SidePanel.cpp
|
inobelar/QSidePanel
|
4554e1bcd3f0942df66ed1357cdac7afdd08597d
|
[
"MIT"
] | null | null | null |
QSidePanel/QSidePanel/SidePanel.cpp
|
inobelar/QSidePanel
|
4554e1bcd3f0942df66ed1357cdac7afdd08597d
|
[
"MIT"
] | 9
|
2019-11-17T20:09:55.000Z
|
2021-10-31T14:54:02.000Z
|
#include "SidePanel.hpp"
#include "math.hpp"
#include "side_panel_helpers.hpp"
#include <QDebug>
void SidePanel::_setState(const SidePanelState new_state) {
if(_state == new_state)
return;
_state = new_state;
emit stateChanged(_state);
}
// -----------------------------------------------------------------------------
#include <QEvent>
bool SidePanel::eventFilter(QObject *watched, QEvent *event)
{
// Important note: DONT RETURN TRUE here, on event receive, because it's
// blocks events handling, if few panels binded to the same parent widget
if(event->type() == QEvent::Resize)
{
switch (_state) {
case SidePanelState::Opened: { const auto geom = getOpenedRect(this->parentWidget()->rect()); this->setGeometry( geom ); this->updateHandlerRect(_anim_progress, geom); } break;
case SidePanelState::Closed: { const auto geom = getClosedRect(this->parentWidget()->rect()); this->setGeometry( geom ); this->updateHandlerRect(_anim_progress, geom); } break;
}
// return true;
}
else if(event->type() == QEvent::Move)
{
switch (_state) {
case SidePanelState::Opened: { const auto geom = getOpenedRect(this->parentWidget()->rect()); this->setGeometry( geom ); this->updateHandlerRect(_anim_progress, geom); } break;
case SidePanelState::Closed: { const auto geom = getClosedRect(this->parentWidget()->rect()); this->setGeometry( geom ); this->updateHandlerRect(_anim_progress, geom); } break;
}
// return true;
}
return base_t::eventFilter(watched, event);
}
// -----------------------------------------------------------------------------
void SidePanel::updateHandlerRect(const qreal progress, const QRect& geom)
{
const QRect handle_geom = alignedHandlerRect( geom, _handler->size() , progress);
_handler->setGeometry( handle_geom );
}
SidePanel::SidePanel(QWidget *parent)
: base_t(parent)
{
/* ======================================================================
This is the place, where NO member std::function IMMEDIATE call alowed.
Call them in init() method
====================================================================== */
const auto anim_func = [this](qreal t) -> void
{
const QRect parent_rect = this->parentWidget()->rect();
const QRectF geom_start = getClosedRect(parent_rect);
const QRectF geom_end = getOpenedRect(parent_rect);
const QRect new_geom = q_sp::lerp(t, geom_start, geom_end).toRect();
this->setGeometry( new_geom );
updateHandlerRect(_anim_progress, new_geom);
qDebug() << new_geom << t;
};
_timer = new QTimer(this);
_timer->setInterval(10);
connect(_timer, &QTimer::timeout, this, [this, anim_func]
{
const auto time_now = std::chrono::system_clock::now();
if((time_now - _time_start) >= _duration)
{
_timer->stop();
// This setGeometry() for cases when duration=200ms, interval_time=100ms;
switch (_state) {
case SidePanelState::Opening: { const auto geom = getOpenedRect(this->parentWidget()->rect()); this->setGeometry( geom ); _anim_progress = 1.0; updateHandlerRect(_anim_progress, geom); } break;
case SidePanelState::Closing: { const auto geom = getClosedRect(this->parentWidget()->rect()); this->setGeometry( geom ); _anim_progress = 0.0; updateHandlerRect(_anim_progress, geom); } break;
default: break;
}
switch (_state) {
case SidePanelState::Opening: { this->show(); _setState(SidePanelState::Opened); } break;
case SidePanelState::Closing: { this->hide(); _setState(SidePanelState::Closed); } break;
default: break;
}
return;
}
const auto time_end = (_time_start + _duration);
// [t_start .. t_now .. t_end] -> [0.0 .. t .. 1.0]
qreal t = q_sp::scale(
time_now.time_since_epoch().count(),
_time_start.time_since_epoch().count(),
time_end.time_since_epoch().count(),
0.0, 1.0);
if(_state == SidePanelState::Closing) // On closing - reverse it
t = (1.0 - t);
_anim_progress = t;
// Pass normalized value through easing functions
if(_state == SidePanelState::Opening)
{
t = curve_on_open.valueForProgress(t);
}
else if(_state == SidePanelState::Closing)
{
t = curve_on_close.valueForProgress(t);
}
anim_func(t);
});
_handler = new HandlerWidgetT(parent);
_handler->setObjectName("SidePanel_handler");
// =========================================================================
// Default behaviour basically the same as PanelLeftSide
this->getOpenedRect = [this](const QRect& parent_rect) -> QRect
{
return q_sp::rect_opened_left(getPanelSize(), parent_rect);
};
this->getClosedRect = [this](const QRect& parent_rect) -> QRect
{
return q_sp::rect_closed_left(getPanelSize(), parent_rect);
};
// -------------------------------------------------------------------------
this->alignedHandlerRect = [](const QRect& panel_geom, const QSize& handler_size, qreal) -> QRect
{
return q_sp::rect_aligned_right_center(panel_geom, handler_size);
};
// -------------------------------------------------------------------------
this->initialHandlerSize = [this]() -> QSize
{
return this->_handler->size();
};
// -------------------------------------------------------------------------
this->updateHandler = [](const SidePanelState state, HandlerWidgetT* handler)
{
Q_UNUSED(state);
Q_UNUSED(handler);
};
}
SidePanel::~SidePanel()
{
if(_timer != nullptr)
{
_timer->stop();
delete _timer;
_timer = nullptr;
}
if(_handler != nullptr) {
delete _handler;
_handler = nullptr;
}
if(parentWidget()) {
removeEventFilter(this);
}
}
void SidePanel::init()
{
QTimer::singleShot(0, [this] {
_handler->resize( initialHandlerSize() );
updateHandler(_state, _handler);
});
connect(_handler, &QAbstractButton::clicked, this, [this]
{
if(_timer->isActive())
{
qDebug() << "CLICK DURING ANIMATION";
switch (_state) {
case SidePanelState::Opening: { _setState(SidePanelState::Closing); } break;
case SidePanelState::Closing: { _setState(SidePanelState::Opening); } break;
default: break;
}
} else
{
switch (_state) {
case SidePanelState::Closed: { this->show(); _setState(SidePanelState::Opening); } break;
case SidePanelState::Opened: { this->show(); _setState(SidePanelState::Closing); } break;
default: break;
}
_time_start = std::chrono::system_clock::now();
_timer->start();
}
});
connect(this, &SidePanel::stateChanged, _handler, [this](SidePanelState state)
{
updateHandler(state, _handler);
});
this->parentWidget()->installEventFilter(this);
// this->hide();
QTimer::singleShot(0, [this] {
const auto geom = getClosedRect(this->parentWidget()->rect()); this->setGeometry( geom ); _anim_progress = 0.0; updateHandlerRect(_anim_progress, geom);
});
}
// -----------------------------------------------------------------------------
void SidePanel::openPanel()
{
_timer->stop(); // Stop animation, if it's running
this->show();
const QRect new_geom = getOpenedRect(this->parentWidget()->rect());
this->setGeometry( new_geom );
_anim_progress = 1.0;
updateHandlerRect(_anim_progress, new_geom);
_setState(SidePanelState::Opened);
}
void SidePanel::closePanel()
{
_timer->stop(); // Stop animation, if it's running
this->hide();
const QRect new_geom = getClosedRect(this->parentWidget()->rect());
this->setGeometry( new_geom );
_anim_progress = 0.0;
updateHandlerRect(_anim_progress, new_geom);
_setState(SidePanelState::Closed);
}
// -----------------------------------------------------------------------------
void SidePanel::setDuration(const std::chrono::milliseconds &duration)
{
_duration = duration;
// TODO: is it safe during animation ?
}
std::chrono::milliseconds SidePanel::getDuration() const
{
return _duration;
}
// -----------------------------------------------------------------------------
void SidePanel::setPanelSize(int size)
{
_panel_size = size;
// TODO: handle somehow opened/closed state. and state during animation
}
int SidePanel::getPanelSize() const
{
return _panel_size;
}
// -----------------------------------------------------------------------------
void SidePanel::setOpenEasingCurve(const QEasingCurve &curve)
{
curve_on_open = curve;
}
void SidePanel::setCloseEasingCurve(const QEasingCurve &curve)
{
curve_on_close = curve;
}
// -----------------------------------------------------------------------------
QSize SidePanel::getHandlerSize() const
{
return _handler->size();
}
// -----------------------------------------------------------------------------
#include <QResizeEvent>
void SidePanel::resizeEvent(QResizeEvent *event)
{
base_t::resizeEvent(event);
updateHandlerRect(_anim_progress, this->geometry());
}
| 28.731343
| 205
| 0.551792
|
inobelar
|
f42aecc0633dbeca7adedb8111865d5f6e63d758
| 1,581
|
cpp
|
C++
|
src/FCFS/fcfs.cpp
|
divshekhar/os_process_schedulers
|
4bfe0accbbd97793d56e22235cfa2b1e8999a025
|
[
"MIT"
] | 5
|
2022-01-17T05:40:25.000Z
|
2022-01-27T16:01:27.000Z
|
src/FCFS/fcfs.cpp
|
divshekhar/os_process_schedulers
|
4bfe0accbbd97793d56e22235cfa2b1e8999a025
|
[
"MIT"
] | null | null | null |
src/FCFS/fcfs.cpp
|
divshekhar/os_process_schedulers
|
4bfe0accbbd97793d56e22235cfa2b1e8999a025
|
[
"MIT"
] | null | null | null |
#include "../../include/fcfs.hpp"
void FCFS::solve()
{
int total_turnaround_time = 0;
int total_waiting_time = 0;
int total_response_time = 0;
int total_idle_time = 0;
std::sort(p, p + n, osps::Process::compareArrival);
for (int i = 0; i < n; i++)
{
int maxStartTime = std::max(p[i - 1].get_completion_time(), p[i].get_arrival_time());
int start_time = (i == 0) ? p[i].get_arrival_time() : maxStartTime;
p[i].set_start_time(start_time);
p[i].set_completion_time(p[i].get_start_time() + p[i].get_burst_time());
p[i].set_turnaround_time(p[i].get_completion_time() - p[i].get_arrival_time());
p[i].set_waiting_time(p[i].get_turnaround_time() - p[i].get_burst_time());
p[i].set_response_time(p[i].get_start_time() - p[i].get_arrival_time());
total_turnaround_time += p[i].get_turnaround_time();
total_waiting_time += p[i].get_waiting_time();
total_response_time += p[i].get_response_time();
total_idle_time += (i == 0) ? (p[i].get_arrival_time()) : (p[i].get_start_time() - p[i - 1].get_completion_time());
}
set_avg_turnaround_time((float)total_turnaround_time / n);
set_avg_waiting_time((float)total_waiting_time / n);
set_avg_response_time((float)total_response_time / n);
set_cpu_utilisation(((p[n - 1].get_completion_time() - total_idle_time) / (float)p[n - 1].get_completion_time()) * 100);
set_throughput(float(n) / (p[n - 1].get_completion_time() - p[0].get_arrival_time()));
std::sort(p, p + n, osps::Process::compareID);
}
| 41.605263
| 124
| 0.649589
|
divshekhar
|
f42ca614d6572ddb779196310b210bd3cbcdde24
| 1,863
|
hpp
|
C++
|
include/private/coherence/component/net/extend/protocol/cache/ContainsAllRequest.hpp
|
chpatel3/coherence-cpp-extend-client
|
4ea5267eae32064dff1e73339aa3fbc9347ef0f6
|
[
"UPL-1.0",
"Apache-2.0"
] | 6
|
2020-07-01T21:38:30.000Z
|
2021-11-03T01:35:11.000Z
|
include/private/coherence/component/net/extend/protocol/cache/ContainsAllRequest.hpp
|
chpatel3/coherence-cpp-extend-client
|
4ea5267eae32064dff1e73339aa3fbc9347ef0f6
|
[
"UPL-1.0",
"Apache-2.0"
] | 1
|
2020-07-24T17:29:22.000Z
|
2020-07-24T18:29:04.000Z
|
include/private/coherence/component/net/extend/protocol/cache/ContainsAllRequest.hpp
|
chpatel3/coherence-cpp-extend-client
|
4ea5267eae32064dff1e73339aa3fbc9347ef0f6
|
[
"UPL-1.0",
"Apache-2.0"
] | 6
|
2020-07-10T18:40:58.000Z
|
2022-02-18T01:23:40.000Z
|
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
#ifndef COH_CONTAINS_ALL_REQUEST_HPP
#define COH_CONTAINS_ALL_REQUEST_HPP
#include "coherence/lang.ns"
#include "private/coherence/component/net/extend/AbstractPofResponse.hpp"
#include "private/coherence/component/net/extend/protocol/cache/AbstractKeySetRequest.hpp"
COH_OPEN_NAMESPACE6(coherence,component,net,extend,protocol,cache)
using coherence::component::net::extend::AbstractPofResponse;
/**
* Map::keySet()::containsAll(Collection::View vColKeys) Request message.
*
* @author jh 2008.02.18
*/
class COH_EXPORT ContainsAllRequest
: public class_spec<ContainsAllRequest,
extends<AbstractKeySetRequest> >
{
friend class factory<ContainsAllRequest>;
// ----- constructors ---------------------------------------------------
protected:
/**
* Create a new ContainsAllRequest instance.
*/
ContainsAllRequest();
private:
/**
* Blocked copy constructor.
*/
ContainsAllRequest(const ContainsAllRequest&);
// ----- Message interface ----------------------------------------------
public:
/**
* {@inheritDoc}
*/
virtual int32_t getTypeId() const;
// ----- internal methods -----------------------------------------------
protected:
/**
* {@inheritDoc}
*/
virtual void onRun(AbstractPofResponse::Handle hResponse);
// ----- constants ------------------------------------------------------
public:
/**
* The type identifier of this Message class.
*/
static const int32_t type_id = 9;
};
COH_CLOSE_NAMESPACE6
#endif // COH_CONTAINS_ALL_REQUEST_HPP
| 24.513158
| 90
| 0.582394
|
chpatel3
|
f42fa4159224b3f20f918fe9f3ad16980a8717e8
| 5,169
|
cc
|
C++
|
tool/SecVerilog-1.0/SecVerilog/vvp/vpi_real.cc
|
gokulprasath7c/secure_i2c_using_ift
|
124384983ba70e8164b7217db70c43dfdf302d4b
|
[
"MIT"
] | 1
|
2019-01-28T21:23:37.000Z
|
2019-01-28T21:23:37.000Z
|
tool/SecVerilog-1.0/SecVerilog/vvp/vpi_real.cc
|
gokulprasath7c/secure_i2c_using_ift
|
124384983ba70e8164b7217db70c43dfdf302d4b
|
[
"MIT"
] | null | null | null |
tool/SecVerilog-1.0/SecVerilog/vvp/vpi_real.cc
|
gokulprasath7c/secure_i2c_using_ift
|
124384983ba70e8164b7217db70c43dfdf302d4b
|
[
"MIT"
] | null | null | null |
/*
* Copyright (c) 2003-2010 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "compile.h"
# include "vpi_priv.h"
# include "schedule.h"
#ifdef CHECK_WITH_VALGRIND
# include "vvp_cleanup.h"
#endif
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cassert>
struct __vpiRealVar* vpip_realvar_from_handle(vpiHandle obj)
{
assert(obj);
if (obj->vpi_type->type_code == vpiRealVar)
return (struct __vpiRealVar*)obj;
else
return 0;
}
static int real_var_get(int code, vpiHandle ref)
{
assert(ref->vpi_type->type_code == vpiRealVar);
struct __vpiRealVar*rfp = vpip_realvar_from_handle(ref);
switch (code) {
case vpiArray:
return rfp->is_netarray != 0;
case vpiSize:
return 1;
case vpiLineNo:
return 0; // Not implemented for now!
case vpiAutomatic:
return (int) vpip_scope(rfp)->is_automatic;
}
return 0;
}
static char* real_var_get_str(int code, vpiHandle ref)
{
assert(ref->vpi_type->type_code == vpiRealVar);
struct __vpiRealVar*rfp = (struct __vpiRealVar*)ref;
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
char *nm, *ixs;
if (rfp->is_netarray) {
nm = strdup(vpi_get_str(vpiName, rfp->within.parent));
s_vpi_value vp;
vp.format = vpiDecStrVal;
vpi_get_value(rfp->id.index, &vp);
ixs = vp.value.str; /* do I need to strdup() this? */
} else {
nm = strdup(rfp->id.name);
ixs = NULL;
}
char *rbuf = generic_get_str(code, &(vpip_scope(rfp)->base), nm, ixs);
free(nm);
return rbuf;
}
static vpiHandle real_var_get_handle(int code, vpiHandle ref)
{
assert(ref->vpi_type->type_code == vpiRealVar);
struct __vpiRealVar*rfp = (struct __vpiRealVar*)ref;
switch (code) {
case vpiParent:
return rfp->is_netarray ? rfp->within.parent : 0;
case vpiIndex:
return rfp->is_netarray ? rfp->id.index : 0;
case vpiScope:
return &(vpip_scope(rfp)->base);
case vpiModule:
return vpip_module(vpip_scope(rfp));
}
return 0;
}
static vpiHandle real_var_iterate(int code, vpiHandle ref)
{
assert(ref->vpi_type->type_code == vpiRealVar);
struct __vpiRealVar*rfp = (struct __vpiRealVar*)ref;
if (code == vpiIndex) {
return rfp->is_netarray ? (rfp->id.index->vpi_type->iterate_)
(code, rfp->id.index) : 0;
}
return 0;
}
static void real_var_get_value(vpiHandle ref, s_vpi_value*vp)
{
assert(ref->vpi_type->type_code == vpiRealVar);
struct __vpiRealVar*rfp
= (struct __vpiRealVar*)ref;
vvp_fun_signal_real*fun
= dynamic_cast<vvp_fun_signal_real*>(rfp->net->fun);
fun->get_value(vp);
}
static vpiHandle real_var_put_value(vpiHandle ref, p_vpi_value vp, int)
{
assert(ref->vpi_type->type_code == vpiRealVar);
double result = real_from_vpi_value(vp);
struct __vpiRealVar*rfp = (struct __vpiRealVar*)ref;
assert(rfp);
vvp_net_ptr_t destination (rfp->net, 0);
vvp_send_real(destination, result, vthread_get_wt_context());
return 0;
}
static const struct __vpirt vpip_real_var_rt = {
vpiRealVar,
real_var_get,
real_var_get_str,
real_var_get_value,
real_var_put_value,
real_var_get_handle,
real_var_iterate,
0,
0
};
void vpip_real_value_change(struct __vpiCallback*cbh,
vpiHandle ref)
{
struct __vpiRealVar*rfp
= (struct __vpiRealVar*)ref;
vvp_fun_signal_real*fun
= dynamic_cast<vvp_fun_signal_real*>(rfp->net->fun);
fun->add_vpi_callback(cbh);
}
vpiHandle vpip_make_real_var(const char*name, vvp_net_t*net)
{
struct __vpiRealVar*obj = (struct __vpiRealVar*)
malloc(sizeof(struct __vpiRealVar));
obj->base.vpi_type = &vpip_real_var_rt;
obj->id.name = name ? vpip_name_string(name) : 0;
obj->is_netarray = 0;
obj->net = net;
obj->within.scope = vpip_peek_current_scope();
return &obj->base;
}
#ifdef CHECK_WITH_VALGRIND
void real_delete(vpiHandle item)
{
struct __vpiRealVar*obj = (struct __vpiRealVar*) item;
vvp_fun_signal_real*fun = (vvp_fun_signal_real*) obj->net->fun;
fun->clear_all_callbacks();
vvp_net_delete(obj->net);
free(obj);
}
#endif
| 25.092233
| 79
| 0.660089
|
gokulprasath7c
|
f436ba7efc21c9dbcbcb048e0d1e963c3c533aa5
| 1,915
|
cpp
|
C++
|
Assignment/Weapon.cpp
|
qimmer/interrealms_test
|
59099a920534aa4283dfb7a575a913faec081460
|
[
"MIT"
] | null | null | null |
Assignment/Weapon.cpp
|
qimmer/interrealms_test
|
59099a920534aa4283dfb7a575a913faec081460
|
[
"MIT"
] | null | null | null |
Assignment/Weapon.cpp
|
qimmer/interrealms_test
|
59099a920534aa4283dfb7a575a913faec081460
|
[
"MIT"
] | null | null | null |
#include "Assignment.h"
#include "Components/BoxComponent.h"
#include "Components/MeshComponent.h"
#include "Projectile.h"
#include "Weapon.h"
AWeapon::AWeapon(const class FObjectInitializer& PCIP)
: Super(PCIP)
{
PrimaryActorTick.bCanEverTick = true;
BoxCollider = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("WeaponCollider"));
RootComponent = BoxCollider;
WeaponMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("WeaponMesh"));
WeaponMesh->AttachTo(RootComponent);
ShootSound = PCIP.CreateDefaultSubobject<UAudioComponent>(this, TEXT("ShootSound"));
ShootSound->bAutoActivate = false;
ShootSound->AttachTo(RootComponent);
}
void AWeapon::BeginPlay()
{
}
void AWeapon::Tick(float DeltaSeconds)
{
}
void AWeapon::Fire(AActor *Murderer)
{
if( Data.Type == EWeapon::EProjectile )
{
if (Data.ProjectileClass != NULL)
{
UWorld* World = GetWorld();
if (World)
{
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = this;
SpawnParams.Instigator = Instigator;
// Spawn location outside the weapon collider!
FVector SpawnLocation = GetActorLocation();
FVector SpawnDirection = Murderer->GetActorForwardVector();
SpawnLocation += SpawnDirection * 20.0f;
// Shoot a bit upwards
SpawnDirection.Z += 0.02f;
SpawnDirection.Normalize();
AProjectile* Projectile = World->SpawnActor<AProjectile>(Data.ProjectileClass, SpawnLocation, SpawnDirection.Rotation(), SpawnParams);
if (Projectile)
{
Projectile->Weapon = this;
Projectile->Fire(SpawnDirection);
ShootSound->Play();
}
}
}
}
}
| 28.58209
| 150
| 0.609922
|
qimmer
|
f4370fe19a850645f785df252ba67add236e26c7
| 1,129
|
cpp
|
C++
|
src/unitiger/hydro.cpp
|
srinivasyadav18/octotiger
|
4d93c50fe345a081b7985ecb4cb698d16c121565
|
[
"BSL-1.0"
] | 35
|
2016-11-17T22:35:11.000Z
|
2022-01-24T19:07:36.000Z
|
src/unitiger/hydro.cpp
|
srinivasyadav18/octotiger
|
4d93c50fe345a081b7985ecb4cb698d16c121565
|
[
"BSL-1.0"
] | 123
|
2016-11-17T21:29:25.000Z
|
2022-03-03T21:40:04.000Z
|
src/unitiger/hydro.cpp
|
srinivasyadav18/octotiger
|
4d93c50fe345a081b7985ecb4cb698d16c121565
|
[
"BSL-1.0"
] | 10
|
2018-11-28T18:17:42.000Z
|
2022-01-25T12:52:37.000Z
|
// Copyright (c) 2019 AUTHORS
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "octotiger/unitiger/unitiger.hpp"
#include "octotiger/unitiger/hydro.hpp"
#include "octotiger/unitiger/physics.hpp"
#include "octotiger/unitiger/physics_impl.hpp"
#include "octotiger/unitiger/hydro_impl/reconstruct.hpp"
#include "octotiger/unitiger/hydro_impl/flux.hpp"
#include "octotiger/unitiger/hydro_impl/boundaries.hpp"
#include "octotiger/unitiger/hydro_impl/advance.hpp"
#include "octotiger/unitiger/hydro_impl/output.hpp"
#include <functional>
namespace hydro {
void output_cell2d(FILE *fp, const std::array<safe_real, 9> &C, int joff, int ioff) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (i < 2)
fprintf(fp, "%i %i %e %i %i %e \n", i + ioff, j + joff, double(C[3 * i + j]), 1, 0, double(C[3 * (i + 1) + j] - C[3 * i + j]));
if (j < 2)
fprintf(fp, "%i %i %e %i %i %e \n", i + ioff, j + joff, double(C[3 * i + j]), 0, 1, double(C[3 * i + j + 1] - C[3 * i + j]));
}
}
}
}
| 30.513514
| 131
| 0.64659
|
srinivasyadav18
|
f440058c246bb002326eebe48fddb5d5eb17f0b1
| 985
|
cpp
|
C++
|
lib/rdf/test/id_tracker_run.cpp
|
GreyMerlin/owl_cpp
|
ccc6128dbd08dcf7fcbe6679ec6acd714732bbb6
|
[
"BSL-1.0"
] | 10
|
2017-12-21T05:20:40.000Z
|
2021-09-18T05:14:01.000Z
|
lib/rdf/test/id_tracker_run.cpp
|
GreyMerlin/owl_cpp
|
ccc6128dbd08dcf7fcbe6679ec6acd714732bbb6
|
[
"BSL-1.0"
] | 2
|
2017-12-21T07:31:54.000Z
|
2021-06-23T08:52:35.000Z
|
lib/rdf/test/id_tracker_run.cpp
|
GreyMerlin/owl_cpp
|
ccc6128dbd08dcf7fcbe6679ec6acd714732bbb6
|
[
"BSL-1.0"
] | 7
|
2016-02-17T13:20:31.000Z
|
2021-11-08T09:30:43.000Z
|
/** @file "/owlcpp/lib/rdf/test/id_tracker_run.cpp"
part of %owlcpp project.
@n @n Distributed under the Boost Software License, Version 1.0; see doc/license.txt.
@n Copyright Mikhail K Levin 2011
*******************************************************************************/
#define BOOST_TEST_MODULE id_tracker_run
#include "boost/test/unit_test.hpp"
#include "owlcpp/detail/id_tracker.hpp"
#include "owlcpp/ns_id.hpp"
namespace owlcpp{ namespace test{
/**@test
*******************************************************************************/
BOOST_AUTO_TEST_CASE( test_id_tracker_01 ) {
detail::Id_tracker<Ns_id> tracker( Ns_id(12) );
BOOST_CHECK_EQUAL(tracker.get(), Ns_id(13));
BOOST_CHECK_EQUAL(tracker.get(), Ns_id(14));
tracker.push(Ns_id(14));
tracker.push(Ns_id(13));
//tracker.push(Ns_id(15)); //assert violation
BOOST_CHECK_EQUAL(tracker.get(), Ns_id(13));
BOOST_CHECK_EQUAL(tracker.get(), Ns_id(14));
}
}//namespace test
}//namespace owlcpp
| 33.965517
| 85
| 0.614213
|
GreyMerlin
|
f4403a15886c681ea8089726ed8563dd11fbc8e4
| 964,237
|
cpp
|
C++
|
spacy/morphology.cpp
|
gghilango/GGH.NLP
|
aa756d51c3f45ad9f71e131eee5a14941cef7677
|
[
"MIT"
] | null | null | null |
spacy/morphology.cpp
|
gghilango/GGH.NLP
|
aa756d51c3f45ad9f71e131eee5a14941cef7677
|
[
"MIT"
] | null | null | null |
spacy/morphology.cpp
|
gghilango/GGH.NLP
|
aa756d51c3f45ad9f71e131eee5a14941cef7677
|
[
"MIT"
] | null | null | null |
/* Generated by Cython 0.23.5 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
#error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_23_5"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
#define CYTHON_USE_PYLONG_INTERNALS 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyClass_Type
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
#define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
#define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
#else
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
#endif
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
#else
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#define PyNumber_Int PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
#ifndef PyUnicode_InternFromString
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#endif
#if PY_VERSION_HEX < 0x030200A4
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
typedef struct {
unaryfunc am_await;
unaryfunc am_aiter;
unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef CYTHON_RESTRICT
#if defined(__GNUC__)
#define CYTHON_RESTRICT __restrict__
#elif defined(_MSC_VER) && _MSC_VER >= 1400
#define CYTHON_RESTRICT __restrict
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_RESTRICT restrict
#else
#define CYTHON_RESTRICT
#endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifndef __cplusplus
#error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
#define CYTHON_INLINE inline
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
x.~T();
}
template<typename T>
class __Pyx_FakeReference {
public:
__Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
T *operator->() { return ptr; }
operator T&() { return *ptr; }
private:
T *ptr;
};
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
float value;
memset(&value, 0xFF, sizeof(value));
return value;
}
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#define __PYX_HAVE__spacy__morphology
#define __PYX_HAVE_API__spacy__morphology
#include "stdint.h"
#include "murmurhash/MurmurHash3.h"
#include "murmurhash/MurmurHash2.h"
#include "string.h"
#include <vector>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
# define CYTHON_NCP_UNUSED
# else
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
(sizeof(type) < sizeof(Py_ssize_t)) ||\
(sizeof(type) > sizeof(Py_ssize_t) &&\
likely(v < (type)PY_SSIZE_T_MAX ||\
v == (type)PY_SSIZE_T_MAX) &&\
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
v == (type)PY_SSIZE_T_MIN))) ||\
(sizeof(type) == sizeof(Py_ssize_t) &&\
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
v == (type)PY_SSIZE_T_MAX))) )
#if defined (__cplusplus) && __cplusplus >= 201103L
#include <cstdlib>
#define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
#define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
#define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER) && defined (_M_X64)
#define __Pyx_sst_abs(value) _abs64(value)
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
#define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
const Py_UNICODE *u_end = u;
while (*u_end++) ;
return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
if (strcmp(default_encoding_c, "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
ascii_chars[c] = c;
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
Py_DECREF(ascii_chars_u);
Py_DECREF(ascii_chars_b);
}
Py_DECREF(default_encoding);
return 0;
bad:
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
Py_DECREF(default_encoding);
return 0;
bad:
Py_XDECREF(default_encoding);
return -1;
}
#endif
#endif
/* Test for GCC > 2.95 */
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
#if !defined(CYTHON_CCOMPLEX)
#if defined(__cplusplus)
#define CYTHON_CCOMPLEX 1
#elif defined(_Complex_I)
#define CYTHON_CCOMPLEX 1
#else
#define CYTHON_CCOMPLEX 0
#endif
#endif
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
#include <complex>
#else
#include <complex.h>
#endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
#undef _Complex_I
#define _Complex_I 1.0fj
#endif
static const char *__pyx_f[] = {
"spacy\\morphology.pyx",
"__init__.pxd",
"spacy\\lexeme.pxd",
"cymem.pxd",
"maps.pxd",
"spacy\\strings.pxd",
"spacy\\vocab.pxd",
"type.pxd",
"spacy\\morphology.pxd",
};
/* "preshed\maps.pxd":5
*
*
* ctypedef uint64_t key_t # <<<<<<<<<<<<<<
*
*
*/
typedef uint64_t __pyx_t_7preshed_4maps_key_t;
/* "typedefs.pxd":5
*
*
* ctypedef uint64_t hash_t # <<<<<<<<<<<<<<
* ctypedef char* utf8_t
* ctypedef int32_t attr_t
*/
typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t;
/* "typedefs.pxd":7
* ctypedef uint64_t hash_t
* ctypedef char* utf8_t
* ctypedef int32_t attr_t # <<<<<<<<<<<<<<
* ctypedef uint64_t flags_t
* ctypedef uint16_t len_t
*/
typedef int32_t __pyx_t_5spacy_8typedefs_attr_t;
/* "typedefs.pxd":8
* ctypedef char* utf8_t
* ctypedef int32_t attr_t
* ctypedef uint64_t flags_t # <<<<<<<<<<<<<<
* ctypedef uint16_t len_t
* ctypedef uint16_t tag_t
*/
typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t;
/* "typedefs.pxd":9
* ctypedef int32_t attr_t
* ctypedef uint64_t flags_t
* ctypedef uint16_t len_t # <<<<<<<<<<<<<<
* ctypedef uint16_t tag_t
*/
typedef uint16_t __pyx_t_5spacy_8typedefs_len_t;
/* "typedefs.pxd":10
* ctypedef uint64_t flags_t
* ctypedef uint16_t len_t
* ctypedef uint16_t tag_t # <<<<<<<<<<<<<<
*/
typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":725
* # in Cython to enable them only on the right systems.
*
* ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t
*/
typedef npy_int8 __pyx_t_5numpy_int8_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":726
*
* ctypedef npy_int8 int8_t
* ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
* ctypedef npy_int32 int32_t
* ctypedef npy_int64 int64_t
*/
typedef npy_int16 __pyx_t_5numpy_int16_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":727
* ctypedef npy_int8 int8_t
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
* ctypedef npy_int64 int64_t
* #ctypedef npy_int96 int96_t
*/
typedef npy_int32 __pyx_t_5numpy_int32_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":728
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t
* ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
* #ctypedef npy_int96 int96_t
* #ctypedef npy_int128 int128_t
*/
typedef npy_int64 __pyx_t_5numpy_int64_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":732
* #ctypedef npy_int128 int128_t
*
* ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t
*/
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":733
*
* ctypedef npy_uint8 uint8_t
* ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
* ctypedef npy_uint32 uint32_t
* ctypedef npy_uint64 uint64_t
*/
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":734
* ctypedef npy_uint8 uint8_t
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
* ctypedef npy_uint64 uint64_t
* #ctypedef npy_uint96 uint96_t
*/
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":735
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t
* ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
* #ctypedef npy_uint96 uint96_t
* #ctypedef npy_uint128 uint128_t
*/
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":739
* #ctypedef npy_uint128 uint128_t
*
* ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
* ctypedef npy_float64 float64_t
* #ctypedef npy_float80 float80_t
*/
typedef npy_float32 __pyx_t_5numpy_float32_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":740
*
* ctypedef npy_float32 float32_t
* ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
* #ctypedef npy_float80 float80_t
* #ctypedef npy_float128 float128_t
*/
typedef npy_float64 __pyx_t_5numpy_float64_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":749
* # The int types are mapped a bit surprising --
* # numpy.int corresponds to 'l' and numpy.long to 'q'
* ctypedef npy_long int_t # <<<<<<<<<<<<<<
* ctypedef npy_longlong long_t
* ctypedef npy_longlong longlong_t
*/
typedef npy_long __pyx_t_5numpy_int_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":750
* # numpy.int corresponds to 'l' and numpy.long to 'q'
* ctypedef npy_long int_t
* ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
* ctypedef npy_longlong longlong_t
*
*/
typedef npy_longlong __pyx_t_5numpy_long_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":751
* ctypedef npy_long int_t
* ctypedef npy_longlong long_t
* ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
*
* ctypedef npy_ulong uint_t
*/
typedef npy_longlong __pyx_t_5numpy_longlong_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":753
* ctypedef npy_longlong longlong_t
*
* ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
* ctypedef npy_ulonglong ulong_t
* ctypedef npy_ulonglong ulonglong_t
*/
typedef npy_ulong __pyx_t_5numpy_uint_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":754
*
* ctypedef npy_ulong uint_t
* ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
* ctypedef npy_ulonglong ulonglong_t
*
*/
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":755
* ctypedef npy_ulong uint_t
* ctypedef npy_ulonglong ulong_t
* ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
*
* ctypedef npy_intp intp_t
*/
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":757
* ctypedef npy_ulonglong ulonglong_t
*
* ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
* ctypedef npy_uintp uintp_t
*
*/
typedef npy_intp __pyx_t_5numpy_intp_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":758
*
* ctypedef npy_intp intp_t
* ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
*
* ctypedef npy_double float_t
*/
typedef npy_uintp __pyx_t_5numpy_uintp_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":760
* ctypedef npy_uintp uintp_t
*
* ctypedef npy_double float_t # <<<<<<<<<<<<<<
* ctypedef npy_double double_t
* ctypedef npy_longdouble longdouble_t
*/
typedef npy_double __pyx_t_5numpy_float_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":761
*
* ctypedef npy_double float_t
* ctypedef npy_double double_t # <<<<<<<<<<<<<<
* ctypedef npy_longdouble longdouble_t
*
*/
typedef npy_double __pyx_t_5numpy_double_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":762
* ctypedef npy_double float_t
* ctypedef npy_double double_t
* ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
*
* ctypedef npy_cfloat cfloat_t
*/
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
typedef ::std::complex< float > __pyx_t_float_complex;
#else
typedef float _Complex __pyx_t_float_complex;
#endif
#else
typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
typedef ::std::complex< double > __pyx_t_double_complex;
#else
typedef double _Complex __pyx_t_double_complex;
#endif
#else
typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
/*--- Type declarations ---*/
struct __pyx_obj_5cymem_5cymem_Pool;
struct __pyx_obj_5cymem_5cymem_Address;
struct __pyx_obj_7preshed_4maps_PreshMap;
struct __pyx_obj_7preshed_4maps_PreshMapArray;
struct __pyx_obj_5spacy_7strings_StringStore;
struct __pyx_obj_5spacy_5vocab_Vocab;
struct __pyx_obj_5spacy_6lexeme_Lexeme;
struct __pyx_obj_5spacy_10morphology_Morphology;
struct __pyx_t_7preshed_4maps_Cell;
struct __pyx_t_7preshed_4maps_MapStruct;
/* "preshed\maps.pxd":8
*
*
* cdef struct Cell: # <<<<<<<<<<<<<<
* key_t key
* void* value
*/
struct __pyx_t_7preshed_4maps_Cell {
__pyx_t_7preshed_4maps_key_t key;
void *value;
};
/* "preshed\maps.pxd":13
*
*
* cdef struct MapStruct: # <<<<<<<<<<<<<<
* Cell* cells
* void* value_for_empty_key
*/
struct __pyx_t_7preshed_4maps_MapStruct {
struct __pyx_t_7preshed_4maps_Cell *cells;
void *value_for_empty_key;
void *value_for_del_key;
__pyx_t_7preshed_4maps_key_t length;
__pyx_t_7preshed_4maps_key_t filled;
int is_empty_key_set;
int is_del_key_set;
};
/* "typedefs.pxd":6
*
* ctypedef uint64_t hash_t
* ctypedef char* utf8_t # <<<<<<<<<<<<<<
* ctypedef int32_t attr_t
* ctypedef uint64_t flags_t
*/
typedef char *__pyx_t_5spacy_8typedefs_utf8_t;
/* "symbols.pxd":1
* cpdef enum symbol_t: # <<<<<<<<<<<<<<
* NIL
* IS_ALPHA
*/
enum __pyx_t_5spacy_7symbols_symbol_t {
__pyx_e_5spacy_7symbols_NIL,
__pyx_e_5spacy_7symbols_IS_ALPHA,
__pyx_e_5spacy_7symbols_IS_ASCII,
__pyx_e_5spacy_7symbols_IS_DIGIT,
__pyx_e_5spacy_7symbols_IS_LOWER,
__pyx_e_5spacy_7symbols_IS_PUNCT,
__pyx_e_5spacy_7symbols_IS_SPACE,
__pyx_e_5spacy_7symbols_IS_TITLE,
__pyx_e_5spacy_7symbols_IS_UPPER,
__pyx_e_5spacy_7symbols_LIKE_URL,
__pyx_e_5spacy_7symbols_LIKE_NUM,
__pyx_e_5spacy_7symbols_LIKE_EMAIL,
__pyx_e_5spacy_7symbols_IS_STOP,
__pyx_e_5spacy_7symbols_IS_OOV,
__pyx_e_5spacy_7symbols_FLAG14 = 14,
__pyx_e_5spacy_7symbols_FLAG15,
__pyx_e_5spacy_7symbols_FLAG16,
__pyx_e_5spacy_7symbols_FLAG17,
__pyx_e_5spacy_7symbols_FLAG18,
__pyx_e_5spacy_7symbols_FLAG19,
__pyx_e_5spacy_7symbols_FLAG20,
__pyx_e_5spacy_7symbols_FLAG21,
__pyx_e_5spacy_7symbols_FLAG22,
__pyx_e_5spacy_7symbols_FLAG23,
__pyx_e_5spacy_7symbols_FLAG24,
__pyx_e_5spacy_7symbols_FLAG25,
__pyx_e_5spacy_7symbols_FLAG26,
__pyx_e_5spacy_7symbols_FLAG27,
__pyx_e_5spacy_7symbols_FLAG28,
__pyx_e_5spacy_7symbols_FLAG29,
__pyx_e_5spacy_7symbols_FLAG30,
__pyx_e_5spacy_7symbols_FLAG31,
__pyx_e_5spacy_7symbols_FLAG32,
__pyx_e_5spacy_7symbols_FLAG33,
__pyx_e_5spacy_7symbols_FLAG34,
__pyx_e_5spacy_7symbols_FLAG35,
__pyx_e_5spacy_7symbols_FLAG36,
__pyx_e_5spacy_7symbols_FLAG37,
__pyx_e_5spacy_7symbols_FLAG38,
__pyx_e_5spacy_7symbols_FLAG39,
__pyx_e_5spacy_7symbols_FLAG40,
__pyx_e_5spacy_7symbols_FLAG41,
__pyx_e_5spacy_7symbols_FLAG42,
__pyx_e_5spacy_7symbols_FLAG43,
__pyx_e_5spacy_7symbols_FLAG44,
__pyx_e_5spacy_7symbols_FLAG45,
__pyx_e_5spacy_7symbols_FLAG46,
__pyx_e_5spacy_7symbols_FLAG47,
__pyx_e_5spacy_7symbols_FLAG48,
__pyx_e_5spacy_7symbols_FLAG49,
__pyx_e_5spacy_7symbols_FLAG50,
__pyx_e_5spacy_7symbols_FLAG51,
__pyx_e_5spacy_7symbols_FLAG52,
__pyx_e_5spacy_7symbols_FLAG53,
__pyx_e_5spacy_7symbols_FLAG54,
__pyx_e_5spacy_7symbols_FLAG55,
__pyx_e_5spacy_7symbols_FLAG56,
__pyx_e_5spacy_7symbols_FLAG57,
__pyx_e_5spacy_7symbols_FLAG58,
__pyx_e_5spacy_7symbols_FLAG59,
__pyx_e_5spacy_7symbols_FLAG60,
__pyx_e_5spacy_7symbols_FLAG61,
__pyx_e_5spacy_7symbols_FLAG62,
__pyx_e_5spacy_7symbols_FLAG63,
__pyx_e_5spacy_7symbols_ID,
__pyx_e_5spacy_7symbols_ORTH,
__pyx_e_5spacy_7symbols_LOWER,
__pyx_e_5spacy_7symbols_NORM,
__pyx_e_5spacy_7symbols_SHAPE,
__pyx_e_5spacy_7symbols_PREFIX,
__pyx_e_5spacy_7symbols_SUFFIX,
__pyx_e_5spacy_7symbols_LENGTH,
__pyx_e_5spacy_7symbols_CLUSTER,
__pyx_e_5spacy_7symbols_LEMMA,
__pyx_e_5spacy_7symbols_POS,
__pyx_e_5spacy_7symbols_TAG,
__pyx_e_5spacy_7symbols_DEP,
__pyx_e_5spacy_7symbols_ENT_IOB,
__pyx_e_5spacy_7symbols_ENT_TYPE,
__pyx_e_5spacy_7symbols_HEAD,
__pyx_e_5spacy_7symbols_SPACY,
__pyx_e_5spacy_7symbols_PROB,
__pyx_e_5spacy_7symbols_ADJ,
__pyx_e_5spacy_7symbols_ADP,
__pyx_e_5spacy_7symbols_ADV,
__pyx_e_5spacy_7symbols_AUX,
__pyx_e_5spacy_7symbols_CONJ,
__pyx_e_5spacy_7symbols_CCONJ,
__pyx_e_5spacy_7symbols_DET,
__pyx_e_5spacy_7symbols_INTJ,
__pyx_e_5spacy_7symbols_NOUN,
__pyx_e_5spacy_7symbols_NUM,
__pyx_e_5spacy_7symbols_PART,
__pyx_e_5spacy_7symbols_PRON,
__pyx_e_5spacy_7symbols_PROPN,
__pyx_e_5spacy_7symbols_PUNCT,
__pyx_e_5spacy_7symbols_SCONJ,
__pyx_e_5spacy_7symbols_SYM,
__pyx_e_5spacy_7symbols_VERB,
__pyx_e_5spacy_7symbols_X,
__pyx_e_5spacy_7symbols_EOL,
__pyx_e_5spacy_7symbols_SPACE,
__pyx_e_5spacy_7symbols_Animacy_anim,
__pyx_e_5spacy_7symbols_Animacy_inam,
__pyx_e_5spacy_7symbols_Animacy_hum,
__pyx_e_5spacy_7symbols_Aspect_freq,
__pyx_e_5spacy_7symbols_Aspect_imp,
__pyx_e_5spacy_7symbols_Aspect_mod,
__pyx_e_5spacy_7symbols_Aspect_none,
__pyx_e_5spacy_7symbols_Aspect_perf,
__pyx_e_5spacy_7symbols_Aspect_iter,
__pyx_e_5spacy_7symbols_Aspect_hab,
__pyx_e_5spacy_7symbols_Case_abe,
__pyx_e_5spacy_7symbols_Case_abl,
__pyx_e_5spacy_7symbols_Case_abs,
__pyx_e_5spacy_7symbols_Case_acc,
__pyx_e_5spacy_7symbols_Case_ade,
__pyx_e_5spacy_7symbols_Case_all,
__pyx_e_5spacy_7symbols_Case_cau,
__pyx_e_5spacy_7symbols_Case_com,
__pyx_e_5spacy_7symbols_Case_cmp,
__pyx_e_5spacy_7symbols_Case_dat,
__pyx_e_5spacy_7symbols_Case_del,
__pyx_e_5spacy_7symbols_Case_dis,
__pyx_e_5spacy_7symbols_Case_ela,
__pyx_e_5spacy_7symbols_Case_equ,
__pyx_e_5spacy_7symbols_Case_ess,
__pyx_e_5spacy_7symbols_Case_gen,
__pyx_e_5spacy_7symbols_Case_ill,
__pyx_e_5spacy_7symbols_Case_ine,
__pyx_e_5spacy_7symbols_Case_ins,
__pyx_e_5spacy_7symbols_Case_loc,
__pyx_e_5spacy_7symbols_Case_lat,
__pyx_e_5spacy_7symbols_Case_nom,
__pyx_e_5spacy_7symbols_Case_par,
__pyx_e_5spacy_7symbols_Case_sub,
__pyx_e_5spacy_7symbols_Case_sup,
__pyx_e_5spacy_7symbols_Case_tem,
__pyx_e_5spacy_7symbols_Case_ter,
__pyx_e_5spacy_7symbols_Case_tra,
__pyx_e_5spacy_7symbols_Case_voc,
__pyx_e_5spacy_7symbols_Definite_two,
__pyx_e_5spacy_7symbols_Definite_def,
__pyx_e_5spacy_7symbols_Definite_red,
__pyx_e_5spacy_7symbols_Definite_cons,
__pyx_e_5spacy_7symbols_Definite_ind,
__pyx_e_5spacy_7symbols_Definite_spec,
__pyx_e_5spacy_7symbols_Degree_cmp,
__pyx_e_5spacy_7symbols_Degree_comp,
__pyx_e_5spacy_7symbols_Degree_none,
__pyx_e_5spacy_7symbols_Degree_pos,
__pyx_e_5spacy_7symbols_Degree_sup,
__pyx_e_5spacy_7symbols_Degree_abs,
__pyx_e_5spacy_7symbols_Degree_com,
__pyx_e_5spacy_7symbols_Degree_dim,
__pyx_e_5spacy_7symbols_Degree_equ,
__pyx_e_5spacy_7symbols_Evident_nfh,
__pyx_e_5spacy_7symbols_Gender_com,
__pyx_e_5spacy_7symbols_Gender_fem,
__pyx_e_5spacy_7symbols_Gender_masc,
__pyx_e_5spacy_7symbols_Gender_neut,
__pyx_e_5spacy_7symbols_Mood_cnd,
__pyx_e_5spacy_7symbols_Mood_imp,
__pyx_e_5spacy_7symbols_Mood_ind,
__pyx_e_5spacy_7symbols_Mood_n,
__pyx_e_5spacy_7symbols_Mood_pot,
__pyx_e_5spacy_7symbols_Mood_sub,
__pyx_e_5spacy_7symbols_Mood_opt,
__pyx_e_5spacy_7symbols_Mood_prp,
__pyx_e_5spacy_7symbols_Mood_adm,
__pyx_e_5spacy_7symbols_Negative_neg,
__pyx_e_5spacy_7symbols_Negative_pos,
__pyx_e_5spacy_7symbols_Negative_yes,
__pyx_e_5spacy_7symbols_Polarity_neg,
__pyx_e_5spacy_7symbols_Polarity_pos,
__pyx_e_5spacy_7symbols_Number_com,
__pyx_e_5spacy_7symbols_Number_dual,
__pyx_e_5spacy_7symbols_Number_none,
__pyx_e_5spacy_7symbols_Number_plur,
__pyx_e_5spacy_7symbols_Number_sing,
__pyx_e_5spacy_7symbols_Number_ptan,
__pyx_e_5spacy_7symbols_Number_count,
__pyx_e_5spacy_7symbols_Number_tri,
__pyx_e_5spacy_7symbols_NumType_card,
__pyx_e_5spacy_7symbols_NumType_dist,
__pyx_e_5spacy_7symbols_NumType_frac,
__pyx_e_5spacy_7symbols_NumType_gen,
__pyx_e_5spacy_7symbols_NumType_mult,
__pyx_e_5spacy_7symbols_NumType_none,
__pyx_e_5spacy_7symbols_NumType_ord,
__pyx_e_5spacy_7symbols_NumType_sets,
__pyx_e_5spacy_7symbols_Person_one,
__pyx_e_5spacy_7symbols_Person_two,
__pyx_e_5spacy_7symbols_Person_three,
__pyx_e_5spacy_7symbols_Person_none,
__pyx_e_5spacy_7symbols_Poss_yes,
__pyx_e_5spacy_7symbols_PronType_advPart,
__pyx_e_5spacy_7symbols_PronType_art,
__pyx_e_5spacy_7symbols_PronType_default,
__pyx_e_5spacy_7symbols_PronType_dem,
__pyx_e_5spacy_7symbols_PronType_ind,
__pyx_e_5spacy_7symbols_PronType_int,
__pyx_e_5spacy_7symbols_PronType_neg,
__pyx_e_5spacy_7symbols_PronType_prs,
__pyx_e_5spacy_7symbols_PronType_rcp,
__pyx_e_5spacy_7symbols_PronType_rel,
__pyx_e_5spacy_7symbols_PronType_tot,
__pyx_e_5spacy_7symbols_PronType_clit,
__pyx_e_5spacy_7symbols_PronType_exc,
__pyx_e_5spacy_7symbols_PronType_emp,
__pyx_e_5spacy_7symbols_Reflex_yes,
__pyx_e_5spacy_7symbols_Tense_fut,
__pyx_e_5spacy_7symbols_Tense_imp,
__pyx_e_5spacy_7symbols_Tense_past,
__pyx_e_5spacy_7symbols_Tense_pres,
__pyx_e_5spacy_7symbols_VerbForm_fin,
__pyx_e_5spacy_7symbols_VerbForm_ger,
__pyx_e_5spacy_7symbols_VerbForm_inf,
__pyx_e_5spacy_7symbols_VerbForm_none,
__pyx_e_5spacy_7symbols_VerbForm_part,
__pyx_e_5spacy_7symbols_VerbForm_partFut,
__pyx_e_5spacy_7symbols_VerbForm_partPast,
__pyx_e_5spacy_7symbols_VerbForm_partPres,
__pyx_e_5spacy_7symbols_VerbForm_sup,
__pyx_e_5spacy_7symbols_VerbForm_trans,
__pyx_e_5spacy_7symbols_VerbForm_conv,
__pyx_e_5spacy_7symbols_VerbForm_gdv,
__pyx_e_5spacy_7symbols_VerbForm_vnoun,
__pyx_e_5spacy_7symbols_Voice_act,
__pyx_e_5spacy_7symbols_Voice_cau,
__pyx_e_5spacy_7symbols_Voice_pass,
__pyx_e_5spacy_7symbols_Voice_mid,
__pyx_e_5spacy_7symbols_Voice_int,
__pyx_e_5spacy_7symbols_Voice_antip,
__pyx_e_5spacy_7symbols_Voice_dir,
__pyx_e_5spacy_7symbols_Voice_inv,
__pyx_e_5spacy_7symbols_Abbr_yes,
__pyx_e_5spacy_7symbols_AdpType_prep,
__pyx_e_5spacy_7symbols_AdpType_post,
__pyx_e_5spacy_7symbols_AdpType_voc,
__pyx_e_5spacy_7symbols_AdpType_comprep,
__pyx_e_5spacy_7symbols_AdpType_circ,
__pyx_e_5spacy_7symbols_AdvType_man,
__pyx_e_5spacy_7symbols_AdvType_loc,
__pyx_e_5spacy_7symbols_AdvType_tim,
__pyx_e_5spacy_7symbols_AdvType_deg,
__pyx_e_5spacy_7symbols_AdvType_cau,
__pyx_e_5spacy_7symbols_AdvType_mod,
__pyx_e_5spacy_7symbols_AdvType_sta,
__pyx_e_5spacy_7symbols_AdvType_ex,
__pyx_e_5spacy_7symbols_AdvType_adadj,
__pyx_e_5spacy_7symbols_ConjType_oper,
__pyx_e_5spacy_7symbols_ConjType_comp,
__pyx_e_5spacy_7symbols_Connegative_yes,
__pyx_e_5spacy_7symbols_Derivation_minen,
__pyx_e_5spacy_7symbols_Derivation_sti,
__pyx_e_5spacy_7symbols_Derivation_inen,
__pyx_e_5spacy_7symbols_Derivation_lainen,
__pyx_e_5spacy_7symbols_Derivation_ja,
__pyx_e_5spacy_7symbols_Derivation_ton,
__pyx_e_5spacy_7symbols_Derivation_vs,
__pyx_e_5spacy_7symbols_Derivation_ttain,
__pyx_e_5spacy_7symbols_Derivation_ttaa,
__pyx_e_5spacy_7symbols_Echo_rdp,
__pyx_e_5spacy_7symbols_Echo_ech,
__pyx_e_5spacy_7symbols_Foreign_foreign,
__pyx_e_5spacy_7symbols_Foreign_fscript,
__pyx_e_5spacy_7symbols_Foreign_tscript,
__pyx_e_5spacy_7symbols_Foreign_yes,
__pyx_e_5spacy_7symbols_Gender_dat_masc,
__pyx_e_5spacy_7symbols_Gender_dat_fem,
__pyx_e_5spacy_7symbols_Gender_erg_masc,
__pyx_e_5spacy_7symbols_Gender_erg_fem,
__pyx_e_5spacy_7symbols_Gender_psor_masc,
__pyx_e_5spacy_7symbols_Gender_psor_fem,
__pyx_e_5spacy_7symbols_Gender_psor_neut,
__pyx_e_5spacy_7symbols_Hyph_yes,
__pyx_e_5spacy_7symbols_InfForm_one,
__pyx_e_5spacy_7symbols_InfForm_two,
__pyx_e_5spacy_7symbols_InfForm_three,
__pyx_e_5spacy_7symbols_NameType_geo,
__pyx_e_5spacy_7symbols_NameType_prs,
__pyx_e_5spacy_7symbols_NameType_giv,
__pyx_e_5spacy_7symbols_NameType_sur,
__pyx_e_5spacy_7symbols_NameType_nat,
__pyx_e_5spacy_7symbols_NameType_com,
__pyx_e_5spacy_7symbols_NameType_pro,
__pyx_e_5spacy_7symbols_NameType_oth,
__pyx_e_5spacy_7symbols_NounType_com,
__pyx_e_5spacy_7symbols_NounType_prop,
__pyx_e_5spacy_7symbols_NounType_class,
__pyx_e_5spacy_7symbols_Number_abs_sing,
__pyx_e_5spacy_7symbols_Number_abs_plur,
__pyx_e_5spacy_7symbols_Number_dat_sing,
__pyx_e_5spacy_7symbols_Number_dat_plur,
__pyx_e_5spacy_7symbols_Number_erg_sing,
__pyx_e_5spacy_7symbols_Number_erg_plur,
__pyx_e_5spacy_7symbols_Number_psee_sing,
__pyx_e_5spacy_7symbols_Number_psee_plur,
__pyx_e_5spacy_7symbols_Number_psor_sing,
__pyx_e_5spacy_7symbols_Number_psor_plur,
__pyx_e_5spacy_7symbols_Number_pauc,
__pyx_e_5spacy_7symbols_Number_grpa,
__pyx_e_5spacy_7symbols_Number_grpl,
__pyx_e_5spacy_7symbols_Number_inv,
__pyx_e_5spacy_7symbols_NumForm_digit,
__pyx_e_5spacy_7symbols_NumForm_roman,
__pyx_e_5spacy_7symbols_NumForm_word,
__pyx_e_5spacy_7symbols_NumValue_one,
__pyx_e_5spacy_7symbols_NumValue_two,
__pyx_e_5spacy_7symbols_NumValue_three,
__pyx_e_5spacy_7symbols_PartForm_pres,
__pyx_e_5spacy_7symbols_PartForm_past,
__pyx_e_5spacy_7symbols_PartForm_agt,
__pyx_e_5spacy_7symbols_PartForm_neg,
__pyx_e_5spacy_7symbols_PartType_mod,
__pyx_e_5spacy_7symbols_PartType_emp,
__pyx_e_5spacy_7symbols_PartType_res,
__pyx_e_5spacy_7symbols_PartType_inf,
__pyx_e_5spacy_7symbols_PartType_vbp,
__pyx_e_5spacy_7symbols_Person_abs_one,
__pyx_e_5spacy_7symbols_Person_abs_two,
__pyx_e_5spacy_7symbols_Person_abs_three,
__pyx_e_5spacy_7symbols_Person_dat_one,
__pyx_e_5spacy_7symbols_Person_dat_two,
__pyx_e_5spacy_7symbols_Person_dat_three,
__pyx_e_5spacy_7symbols_Person_erg_one,
__pyx_e_5spacy_7symbols_Person_erg_two,
__pyx_e_5spacy_7symbols_Person_erg_three,
__pyx_e_5spacy_7symbols_Person_psor_one,
__pyx_e_5spacy_7symbols_Person_psor_two,
__pyx_e_5spacy_7symbols_Person_psor_three,
__pyx_e_5spacy_7symbols_Person_zero,
__pyx_e_5spacy_7symbols_Person_four,
__pyx_e_5spacy_7symbols_Polite_inf,
__pyx_e_5spacy_7symbols_Polite_pol,
__pyx_e_5spacy_7symbols_Polite_abs_inf,
__pyx_e_5spacy_7symbols_Polite_abs_pol,
__pyx_e_5spacy_7symbols_Polite_erg_inf,
__pyx_e_5spacy_7symbols_Polite_erg_pol,
__pyx_e_5spacy_7symbols_Polite_dat_inf,
__pyx_e_5spacy_7symbols_Polite_dat_pol,
__pyx_e_5spacy_7symbols_Polite_infm,
__pyx_e_5spacy_7symbols_Polite_form,
__pyx_e_5spacy_7symbols_Polite_form_elev,
__pyx_e_5spacy_7symbols_Polite_form_humb,
__pyx_e_5spacy_7symbols_Prefix_yes,
__pyx_e_5spacy_7symbols_PrepCase_npr,
__pyx_e_5spacy_7symbols_PrepCase_pre,
__pyx_e_5spacy_7symbols_PunctSide_ini,
__pyx_e_5spacy_7symbols_PunctSide_fin,
__pyx_e_5spacy_7symbols_PunctType_peri,
__pyx_e_5spacy_7symbols_PunctType_qest,
__pyx_e_5spacy_7symbols_PunctType_excl,
__pyx_e_5spacy_7symbols_PunctType_quot,
__pyx_e_5spacy_7symbols_PunctType_brck,
__pyx_e_5spacy_7symbols_PunctType_comm,
__pyx_e_5spacy_7symbols_PunctType_colo,
__pyx_e_5spacy_7symbols_PunctType_semi,
__pyx_e_5spacy_7symbols_PunctType_dash,
__pyx_e_5spacy_7symbols_Style_arch,
__pyx_e_5spacy_7symbols_Style_rare,
__pyx_e_5spacy_7symbols_Style_poet,
__pyx_e_5spacy_7symbols_Style_norm,
__pyx_e_5spacy_7symbols_Style_coll,
__pyx_e_5spacy_7symbols_Style_vrnc,
__pyx_e_5spacy_7symbols_Style_sing,
__pyx_e_5spacy_7symbols_Style_expr,
__pyx_e_5spacy_7symbols_Style_derg,
__pyx_e_5spacy_7symbols_Style_vulg,
__pyx_e_5spacy_7symbols_Style_yes,
__pyx_e_5spacy_7symbols_StyleVariant_styleShort,
__pyx_e_5spacy_7symbols_StyleVariant_styleBound,
__pyx_e_5spacy_7symbols_VerbType_aux,
__pyx_e_5spacy_7symbols_VerbType_cop,
__pyx_e_5spacy_7symbols_VerbType_mod,
__pyx_e_5spacy_7symbols_VerbType_light,
__pyx_e_5spacy_7symbols_PERSON,
__pyx_e_5spacy_7symbols_NORP,
__pyx_e_5spacy_7symbols_FACILITY,
__pyx_e_5spacy_7symbols_ORG,
__pyx_e_5spacy_7symbols_GPE,
__pyx_e_5spacy_7symbols_LOC,
__pyx_e_5spacy_7symbols_PRODUCT,
__pyx_e_5spacy_7symbols_EVENT,
__pyx_e_5spacy_7symbols_WORK_OF_ART,
__pyx_e_5spacy_7symbols_LANGUAGE,
__pyx_e_5spacy_7symbols_DATE,
__pyx_e_5spacy_7symbols_TIME,
__pyx_e_5spacy_7symbols_PERCENT,
__pyx_e_5spacy_7symbols_MONEY,
__pyx_e_5spacy_7symbols_QUANTITY,
__pyx_e_5spacy_7symbols_ORDINAL,
__pyx_e_5spacy_7symbols_CARDINAL,
__pyx_e_5spacy_7symbols_acomp,
__pyx_e_5spacy_7symbols_advcl,
__pyx_e_5spacy_7symbols_advmod,
__pyx_e_5spacy_7symbols_agent,
__pyx_e_5spacy_7symbols_amod,
__pyx_e_5spacy_7symbols_appos,
__pyx_e_5spacy_7symbols_attr,
__pyx_e_5spacy_7symbols_aux,
__pyx_e_5spacy_7symbols_auxpass,
__pyx_e_5spacy_7symbols_cc,
__pyx_e_5spacy_7symbols_ccomp,
__pyx_e_5spacy_7symbols_complm,
__pyx_e_5spacy_7symbols_conj,
__pyx_e_5spacy_7symbols_cop,
__pyx_e_5spacy_7symbols_csubj,
__pyx_e_5spacy_7symbols_csubjpass,
__pyx_e_5spacy_7symbols_dep,
__pyx_e_5spacy_7symbols_det,
__pyx_e_5spacy_7symbols_dobj,
__pyx_e_5spacy_7symbols_expl,
__pyx_e_5spacy_7symbols_hmod,
__pyx_e_5spacy_7symbols_hyph,
__pyx_e_5spacy_7symbols_infmod,
__pyx_e_5spacy_7symbols_intj,
__pyx_e_5spacy_7symbols_iobj,
__pyx_e_5spacy_7symbols_mark,
__pyx_e_5spacy_7symbols_meta,
__pyx_e_5spacy_7symbols_neg,
__pyx_e_5spacy_7symbols_nmod,
__pyx_e_5spacy_7symbols_nn,
__pyx_e_5spacy_7symbols_npadvmod,
__pyx_e_5spacy_7symbols_nsubj,
__pyx_e_5spacy_7symbols_nsubjpass,
__pyx_e_5spacy_7symbols_num,
__pyx_e_5spacy_7symbols_number,
__pyx_e_5spacy_7symbols_oprd,
__pyx_e_5spacy_7symbols_obj,
__pyx_e_5spacy_7symbols_obl,
__pyx_e_5spacy_7symbols_parataxis,
__pyx_e_5spacy_7symbols_partmod,
__pyx_e_5spacy_7symbols_pcomp,
__pyx_e_5spacy_7symbols_pobj,
__pyx_e_5spacy_7symbols_poss,
__pyx_e_5spacy_7symbols_possessive,
__pyx_e_5spacy_7symbols_preconj,
__pyx_e_5spacy_7symbols_prep,
__pyx_e_5spacy_7symbols_prt,
__pyx_e_5spacy_7symbols_punct,
__pyx_e_5spacy_7symbols_quantmod,
__pyx_e_5spacy_7symbols_rcmod,
__pyx_e_5spacy_7symbols_root,
__pyx_e_5spacy_7symbols_xcomp
};
/* "parts_of_speech.pxd":3
* from . cimport symbols
*
* cpdef enum univ_pos_t: # <<<<<<<<<<<<<<
* NO_TAG = 0
* ADJ = symbols.ADJ
*/
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t {
/* "parts_of_speech.pxd":5
* cpdef enum univ_pos_t:
* NO_TAG = 0
* ADJ = symbols.ADJ # <<<<<<<<<<<<<<
* ADP
* ADV
*/
__pyx_e_5spacy_15parts_of_speech_NO_TAG = 0,
__pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ,
__pyx_e_5spacy_15parts_of_speech_ADP,
__pyx_e_5spacy_15parts_of_speech_ADV,
__pyx_e_5spacy_15parts_of_speech_AUX,
__pyx_e_5spacy_15parts_of_speech_CONJ,
__pyx_e_5spacy_15parts_of_speech_CCONJ,
__pyx_e_5spacy_15parts_of_speech_DET,
__pyx_e_5spacy_15parts_of_speech_INTJ,
__pyx_e_5spacy_15parts_of_speech_NOUN,
__pyx_e_5spacy_15parts_of_speech_NUM,
__pyx_e_5spacy_15parts_of_speech_PART,
__pyx_e_5spacy_15parts_of_speech_PRON,
__pyx_e_5spacy_15parts_of_speech_PROPN,
__pyx_e_5spacy_15parts_of_speech_PUNCT,
__pyx_e_5spacy_15parts_of_speech_SCONJ,
__pyx_e_5spacy_15parts_of_speech_SYM,
__pyx_e_5spacy_15parts_of_speech_VERB,
__pyx_e_5spacy_15parts_of_speech_X,
__pyx_e_5spacy_15parts_of_speech_EOL,
__pyx_e_5spacy_15parts_of_speech_SPACE
};
struct __pyx_t_5spacy_7structs_LexemeC;
struct __pyx_t_5spacy_7structs_Entity;
struct __pyx_t_5spacy_7structs_TokenC;
/* "structs.pxd":7
*
*
* cdef struct LexemeC: # <<<<<<<<<<<<<<
* float* vector
*
*/
struct __pyx_t_5spacy_7structs_LexemeC {
float *vector;
__pyx_t_5spacy_8typedefs_flags_t flags;
__pyx_t_5spacy_8typedefs_attr_t lang;
__pyx_t_5spacy_8typedefs_attr_t id;
__pyx_t_5spacy_8typedefs_attr_t length;
__pyx_t_5spacy_8typedefs_attr_t orth;
__pyx_t_5spacy_8typedefs_attr_t lower;
__pyx_t_5spacy_8typedefs_attr_t norm;
__pyx_t_5spacy_8typedefs_attr_t shape;
__pyx_t_5spacy_8typedefs_attr_t prefix;
__pyx_t_5spacy_8typedefs_attr_t suffix;
__pyx_t_5spacy_8typedefs_attr_t cluster;
float prob;
float sentiment;
float l2_norm;
};
/* "structs.pxd":31
*
*
* cdef struct Entity: # <<<<<<<<<<<<<<
* hash_t id
* int start
*/
struct __pyx_t_5spacy_7structs_Entity {
__pyx_t_5spacy_8typedefs_hash_t id;
int start;
int end;
int label;
};
/* "structs.pxd":38
*
*
* cdef struct TokenC: # <<<<<<<<<<<<<<
* const LexemeC* lex
* uint64_t morph
*/
struct __pyx_t_5spacy_7structs_TokenC {
struct __pyx_t_5spacy_7structs_LexemeC const *lex;
uint64_t morph;
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos;
int spacy;
int tag;
int idx;
int lemma;
int sense;
int head;
int dep;
int sent_start;
uint32_t l_kids;
uint32_t r_kids;
uint32_t l_edge;
uint32_t r_edge;
int ent_iob;
int ent_type;
__pyx_t_5spacy_8typedefs_hash_t ent_id;
};
union __pyx_t_5spacy_7strings_Utf8Str;
typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str;
/* "strings.pxd":13
*
*
* ctypedef union Utf8Str: # <<<<<<<<<<<<<<
* unsigned char[8] s
* unsigned char* p
*/
union __pyx_t_5spacy_7strings_Utf8Str {
unsigned char s[8];
unsigned char *p;
};
/* "attrs.pxd":2
* # Reserve 64 values for flag features
* cpdef enum attr_id_t: # <<<<<<<<<<<<<<
* NULL_ATTR
* IS_ALPHA
*/
enum __pyx_t_5spacy_5attrs_attr_id_t {
__pyx_e_5spacy_5attrs_NULL_ATTR,
__pyx_e_5spacy_5attrs_IS_ALPHA,
__pyx_e_5spacy_5attrs_IS_ASCII,
__pyx_e_5spacy_5attrs_IS_DIGIT,
__pyx_e_5spacy_5attrs_IS_LOWER,
__pyx_e_5spacy_5attrs_IS_PUNCT,
__pyx_e_5spacy_5attrs_IS_SPACE,
__pyx_e_5spacy_5attrs_IS_TITLE,
__pyx_e_5spacy_5attrs_IS_UPPER,
__pyx_e_5spacy_5attrs_LIKE_URL,
__pyx_e_5spacy_5attrs_LIKE_NUM,
__pyx_e_5spacy_5attrs_LIKE_EMAIL,
__pyx_e_5spacy_5attrs_IS_STOP,
__pyx_e_5spacy_5attrs_IS_OOV,
__pyx_e_5spacy_5attrs_IS_BRACKET,
__pyx_e_5spacy_5attrs_IS_QUOTE,
__pyx_e_5spacy_5attrs_IS_LEFT_PUNCT,
__pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT,
__pyx_e_5spacy_5attrs_FLAG18 = 18,
__pyx_e_5spacy_5attrs_FLAG19,
__pyx_e_5spacy_5attrs_FLAG20,
__pyx_e_5spacy_5attrs_FLAG21,
__pyx_e_5spacy_5attrs_FLAG22,
__pyx_e_5spacy_5attrs_FLAG23,
__pyx_e_5spacy_5attrs_FLAG24,
__pyx_e_5spacy_5attrs_FLAG25,
__pyx_e_5spacy_5attrs_FLAG26,
__pyx_e_5spacy_5attrs_FLAG27,
__pyx_e_5spacy_5attrs_FLAG28,
__pyx_e_5spacy_5attrs_FLAG29,
__pyx_e_5spacy_5attrs_FLAG30,
__pyx_e_5spacy_5attrs_FLAG31,
__pyx_e_5spacy_5attrs_FLAG32,
__pyx_e_5spacy_5attrs_FLAG33,
__pyx_e_5spacy_5attrs_FLAG34,
__pyx_e_5spacy_5attrs_FLAG35,
__pyx_e_5spacy_5attrs_FLAG36,
__pyx_e_5spacy_5attrs_FLAG37,
__pyx_e_5spacy_5attrs_FLAG38,
__pyx_e_5spacy_5attrs_FLAG39,
__pyx_e_5spacy_5attrs_FLAG40,
__pyx_e_5spacy_5attrs_FLAG41,
__pyx_e_5spacy_5attrs_FLAG42,
__pyx_e_5spacy_5attrs_FLAG43,
__pyx_e_5spacy_5attrs_FLAG44,
__pyx_e_5spacy_5attrs_FLAG45,
__pyx_e_5spacy_5attrs_FLAG46,
__pyx_e_5spacy_5attrs_FLAG47,
__pyx_e_5spacy_5attrs_FLAG48,
__pyx_e_5spacy_5attrs_FLAG49,
__pyx_e_5spacy_5attrs_FLAG50,
__pyx_e_5spacy_5attrs_FLAG51,
__pyx_e_5spacy_5attrs_FLAG52,
__pyx_e_5spacy_5attrs_FLAG53,
__pyx_e_5spacy_5attrs_FLAG54,
__pyx_e_5spacy_5attrs_FLAG55,
__pyx_e_5spacy_5attrs_FLAG56,
__pyx_e_5spacy_5attrs_FLAG57,
__pyx_e_5spacy_5attrs_FLAG58,
__pyx_e_5spacy_5attrs_FLAG59,
__pyx_e_5spacy_5attrs_FLAG60,
__pyx_e_5spacy_5attrs_FLAG61,
__pyx_e_5spacy_5attrs_FLAG62,
__pyx_e_5spacy_5attrs_FLAG63,
__pyx_e_5spacy_5attrs_ID,
__pyx_e_5spacy_5attrs_ORTH,
__pyx_e_5spacy_5attrs_LOWER,
__pyx_e_5spacy_5attrs_NORM,
__pyx_e_5spacy_5attrs_SHAPE,
__pyx_e_5spacy_5attrs_PREFIX,
__pyx_e_5spacy_5attrs_SUFFIX,
__pyx_e_5spacy_5attrs_LENGTH,
__pyx_e_5spacy_5attrs_CLUSTER,
__pyx_e_5spacy_5attrs_LEMMA,
__pyx_e_5spacy_5attrs_POS,
__pyx_e_5spacy_5attrs_TAG,
__pyx_e_5spacy_5attrs_DEP,
__pyx_e_5spacy_5attrs_ENT_IOB,
__pyx_e_5spacy_5attrs_ENT_TYPE,
__pyx_e_5spacy_5attrs_HEAD,
__pyx_e_5spacy_5attrs_SPACY,
__pyx_e_5spacy_5attrs_PROB,
__pyx_e_5spacy_5attrs_LANG
};
union __pyx_t_5spacy_5vocab_LexemesOrTokens;
struct __pyx_t_5spacy_5vocab__Cached;
/* "vocab.pxd":16
*
*
* cdef union LexemesOrTokens: # <<<<<<<<<<<<<<
* const LexemeC* const* lexemes
* const TokenC* tokens
*/
union __pyx_t_5spacy_5vocab_LexemesOrTokens {
struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes;
struct __pyx_t_5spacy_7structs_TokenC const *tokens;
};
/* "vocab.pxd":21
*
*
* cdef struct _Cached: # <<<<<<<<<<<<<<
* LexemesOrTokens data
* bint is_lex
*/
struct __pyx_t_5spacy_5vocab__Cached {
union __pyx_t_5spacy_5vocab_LexemesOrTokens data;
int is_lex;
int length;
};
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":764
* ctypedef npy_longdouble longdouble_t
*
* ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
* ctypedef npy_cdouble cdouble_t
* ctypedef npy_clongdouble clongdouble_t
*/
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":765
*
* ctypedef npy_cfloat cfloat_t
* ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
* ctypedef npy_clongdouble clongdouble_t
*
*/
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":766
* ctypedef npy_cfloat cfloat_t
* ctypedef npy_cdouble cdouble_t
* ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
*
* ctypedef npy_cdouble complex_t
*/
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":768
* ctypedef npy_clongdouble clongdouble_t
*
* ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew1(a):
*/
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_t_5spacy_10morphology_RichTagC;
struct __pyx_t_5spacy_10morphology_MorphAnalysisC;
/* "spacy\morphology.pxd":44
*
*
* cpdef enum univ_morph_t: # <<<<<<<<<<<<<<
* NIL = 0
* Animacy_anim = symbols.Animacy_anim
*/
enum __pyx_t_5spacy_10morphology_univ_morph_t {
/* "spacy\morphology.pxd":46
* cpdef enum univ_morph_t:
* NIL = 0
* Animacy_anim = symbols.Animacy_anim # <<<<<<<<<<<<<<
* Animacy_inam
* Aspect_freq
*/
__pyx_e_5spacy_10morphology_NIL = 0,
__pyx_e_5spacy_10morphology_Animacy_anim = __pyx_e_5spacy_7symbols_Animacy_anim,
__pyx_e_5spacy_10morphology_Animacy_inam,
__pyx_e_5spacy_10morphology_Aspect_freq,
__pyx_e_5spacy_10morphology_Aspect_imp,
__pyx_e_5spacy_10morphology_Aspect_mod,
__pyx_e_5spacy_10morphology_Aspect_none,
__pyx_e_5spacy_10morphology_Aspect_perf,
__pyx_e_5spacy_10morphology_Case_abe,
__pyx_e_5spacy_10morphology_Case_abl,
__pyx_e_5spacy_10morphology_Case_abs,
__pyx_e_5spacy_10morphology_Case_acc,
__pyx_e_5spacy_10morphology_Case_ade,
__pyx_e_5spacy_10morphology_Case_all,
__pyx_e_5spacy_10morphology_Case_cau,
__pyx_e_5spacy_10morphology_Case_com,
__pyx_e_5spacy_10morphology_Case_dat,
__pyx_e_5spacy_10morphology_Case_del,
__pyx_e_5spacy_10morphology_Case_dis,
__pyx_e_5spacy_10morphology_Case_ela,
__pyx_e_5spacy_10morphology_Case_ess,
__pyx_e_5spacy_10morphology_Case_gen,
__pyx_e_5spacy_10morphology_Case_ill,
__pyx_e_5spacy_10morphology_Case_ine,
__pyx_e_5spacy_10morphology_Case_ins,
__pyx_e_5spacy_10morphology_Case_loc,
__pyx_e_5spacy_10morphology_Case_lat,
__pyx_e_5spacy_10morphology_Case_nom,
__pyx_e_5spacy_10morphology_Case_par,
__pyx_e_5spacy_10morphology_Case_sub,
__pyx_e_5spacy_10morphology_Case_sup,
__pyx_e_5spacy_10morphology_Case_tem,
__pyx_e_5spacy_10morphology_Case_ter,
__pyx_e_5spacy_10morphology_Case_tra,
__pyx_e_5spacy_10morphology_Case_voc,
__pyx_e_5spacy_10morphology_Definite_two,
__pyx_e_5spacy_10morphology_Definite_def,
__pyx_e_5spacy_10morphology_Definite_red,
__pyx_e_5spacy_10morphology_Definite_cons,
__pyx_e_5spacy_10morphology_Definite_ind,
__pyx_e_5spacy_10morphology_Degree_cmp,
__pyx_e_5spacy_10morphology_Degree_comp,
__pyx_e_5spacy_10morphology_Degree_none,
__pyx_e_5spacy_10morphology_Degree_pos,
__pyx_e_5spacy_10morphology_Degree_sup,
__pyx_e_5spacy_10morphology_Degree_abs,
__pyx_e_5spacy_10morphology_Degree_com,
__pyx_e_5spacy_10morphology_Degree_dim,
__pyx_e_5spacy_10morphology_Gender_com,
__pyx_e_5spacy_10morphology_Gender_fem,
__pyx_e_5spacy_10morphology_Gender_masc,
__pyx_e_5spacy_10morphology_Gender_neut,
__pyx_e_5spacy_10morphology_Mood_cnd,
__pyx_e_5spacy_10morphology_Mood_imp,
__pyx_e_5spacy_10morphology_Mood_ind,
__pyx_e_5spacy_10morphology_Mood_n,
__pyx_e_5spacy_10morphology_Mood_pot,
__pyx_e_5spacy_10morphology_Mood_sub,
__pyx_e_5spacy_10morphology_Mood_opt,
__pyx_e_5spacy_10morphology_Negative_neg,
__pyx_e_5spacy_10morphology_Negative_pos,
__pyx_e_5spacy_10morphology_Negative_yes,
__pyx_e_5spacy_10morphology_Polarity_neg,
__pyx_e_5spacy_10morphology_Polarity_pos,
__pyx_e_5spacy_10morphology_Number_com,
__pyx_e_5spacy_10morphology_Number_dual,
__pyx_e_5spacy_10morphology_Number_none,
__pyx_e_5spacy_10morphology_Number_plur,
__pyx_e_5spacy_10morphology_Number_sing,
__pyx_e_5spacy_10morphology_Number_ptan,
__pyx_e_5spacy_10morphology_Number_count,
__pyx_e_5spacy_10morphology_NumType_card,
__pyx_e_5spacy_10morphology_NumType_dist,
__pyx_e_5spacy_10morphology_NumType_frac,
__pyx_e_5spacy_10morphology_NumType_gen,
__pyx_e_5spacy_10morphology_NumType_mult,
__pyx_e_5spacy_10morphology_NumType_none,
__pyx_e_5spacy_10morphology_NumType_ord,
__pyx_e_5spacy_10morphology_NumType_sets,
__pyx_e_5spacy_10morphology_Person_one,
__pyx_e_5spacy_10morphology_Person_two,
__pyx_e_5spacy_10morphology_Person_three,
__pyx_e_5spacy_10morphology_Person_none,
__pyx_e_5spacy_10morphology_Poss_yes,
__pyx_e_5spacy_10morphology_PronType_advPart,
__pyx_e_5spacy_10morphology_PronType_art,
__pyx_e_5spacy_10morphology_PronType_default,
__pyx_e_5spacy_10morphology_PronType_dem,
__pyx_e_5spacy_10morphology_PronType_ind,
__pyx_e_5spacy_10morphology_PronType_int,
__pyx_e_5spacy_10morphology_PronType_neg,
__pyx_e_5spacy_10morphology_PronType_prs,
__pyx_e_5spacy_10morphology_PronType_rcp,
__pyx_e_5spacy_10morphology_PronType_rel,
__pyx_e_5spacy_10morphology_PronType_tot,
__pyx_e_5spacy_10morphology_PronType_clit,
__pyx_e_5spacy_10morphology_PronType_exc,
__pyx_e_5spacy_10morphology_Reflex_yes,
__pyx_e_5spacy_10morphology_Tense_fut,
__pyx_e_5spacy_10morphology_Tense_imp,
__pyx_e_5spacy_10morphology_Tense_past,
__pyx_e_5spacy_10morphology_Tense_pres,
__pyx_e_5spacy_10morphology_VerbForm_fin,
__pyx_e_5spacy_10morphology_VerbForm_ger,
__pyx_e_5spacy_10morphology_VerbForm_inf,
__pyx_e_5spacy_10morphology_VerbForm_none,
__pyx_e_5spacy_10morphology_VerbForm_part,
__pyx_e_5spacy_10morphology_VerbForm_partFut,
__pyx_e_5spacy_10morphology_VerbForm_partPast,
__pyx_e_5spacy_10morphology_VerbForm_partPres,
__pyx_e_5spacy_10morphology_VerbForm_sup,
__pyx_e_5spacy_10morphology_VerbForm_trans,
__pyx_e_5spacy_10morphology_VerbForm_conv,
__pyx_e_5spacy_10morphology_VerbForm_gdv,
__pyx_e_5spacy_10morphology_Voice_act,
__pyx_e_5spacy_10morphology_Voice_cau,
__pyx_e_5spacy_10morphology_Voice_pass,
__pyx_e_5spacy_10morphology_Voice_mid,
__pyx_e_5spacy_10morphology_Voice_int,
__pyx_e_5spacy_10morphology_Abbr_yes,
__pyx_e_5spacy_10morphology_AdpType_prep,
__pyx_e_5spacy_10morphology_AdpType_post,
__pyx_e_5spacy_10morphology_AdpType_voc,
__pyx_e_5spacy_10morphology_AdpType_comprep,
__pyx_e_5spacy_10morphology_AdpType_circ,
__pyx_e_5spacy_10morphology_AdvType_man,
__pyx_e_5spacy_10morphology_AdvType_loc,
__pyx_e_5spacy_10morphology_AdvType_tim,
__pyx_e_5spacy_10morphology_AdvType_deg,
__pyx_e_5spacy_10morphology_AdvType_cau,
__pyx_e_5spacy_10morphology_AdvType_mod,
__pyx_e_5spacy_10morphology_AdvType_sta,
__pyx_e_5spacy_10morphology_AdvType_ex,
__pyx_e_5spacy_10morphology_AdvType_adadj,
__pyx_e_5spacy_10morphology_ConjType_oper,
__pyx_e_5spacy_10morphology_ConjType_comp,
__pyx_e_5spacy_10morphology_Connegative_yes,
__pyx_e_5spacy_10morphology_Derivation_minen,
__pyx_e_5spacy_10morphology_Derivation_sti,
__pyx_e_5spacy_10morphology_Derivation_inen,
__pyx_e_5spacy_10morphology_Derivation_lainen,
__pyx_e_5spacy_10morphology_Derivation_ja,
__pyx_e_5spacy_10morphology_Derivation_ton,
__pyx_e_5spacy_10morphology_Derivation_vs,
__pyx_e_5spacy_10morphology_Derivation_ttain,
__pyx_e_5spacy_10morphology_Derivation_ttaa,
__pyx_e_5spacy_10morphology_Echo_rdp,
__pyx_e_5spacy_10morphology_Echo_ech,
__pyx_e_5spacy_10morphology_Foreign_foreign,
__pyx_e_5spacy_10morphology_Foreign_fscript,
__pyx_e_5spacy_10morphology_Foreign_tscript,
__pyx_e_5spacy_10morphology_Foreign_yes,
__pyx_e_5spacy_10morphology_Gender_dat_masc,
__pyx_e_5spacy_10morphology_Gender_dat_fem,
__pyx_e_5spacy_10morphology_Gender_erg_masc,
__pyx_e_5spacy_10morphology_Gender_erg_fem,
__pyx_e_5spacy_10morphology_Gender_psor_masc,
__pyx_e_5spacy_10morphology_Gender_psor_fem,
__pyx_e_5spacy_10morphology_Gender_psor_neut,
__pyx_e_5spacy_10morphology_Hyph_yes,
__pyx_e_5spacy_10morphology_InfForm_one,
__pyx_e_5spacy_10morphology_InfForm_two,
__pyx_e_5spacy_10morphology_InfForm_three,
__pyx_e_5spacy_10morphology_NameType_geo,
__pyx_e_5spacy_10morphology_NameType_prs,
__pyx_e_5spacy_10morphology_NameType_giv,
__pyx_e_5spacy_10morphology_NameType_sur,
__pyx_e_5spacy_10morphology_NameType_nat,
__pyx_e_5spacy_10morphology_NameType_com,
__pyx_e_5spacy_10morphology_NameType_pro,
__pyx_e_5spacy_10morphology_NameType_oth,
__pyx_e_5spacy_10morphology_NounType_com,
__pyx_e_5spacy_10morphology_NounType_prop,
__pyx_e_5spacy_10morphology_NounType_class,
__pyx_e_5spacy_10morphology_Number_abs_sing,
__pyx_e_5spacy_10morphology_Number_abs_plur,
__pyx_e_5spacy_10morphology_Number_dat_sing,
__pyx_e_5spacy_10morphology_Number_dat_plur,
__pyx_e_5spacy_10morphology_Number_erg_sing,
__pyx_e_5spacy_10morphology_Number_erg_plur,
__pyx_e_5spacy_10morphology_Number_psee_sing,
__pyx_e_5spacy_10morphology_Number_psee_plur,
__pyx_e_5spacy_10morphology_Number_psor_sing,
__pyx_e_5spacy_10morphology_Number_psor_plur,
__pyx_e_5spacy_10morphology_NumForm_digit,
__pyx_e_5spacy_10morphology_NumForm_roman,
__pyx_e_5spacy_10morphology_NumForm_word,
__pyx_e_5spacy_10morphology_NumValue_one,
__pyx_e_5spacy_10morphology_NumValue_two,
__pyx_e_5spacy_10morphology_NumValue_three,
__pyx_e_5spacy_10morphology_PartForm_pres,
__pyx_e_5spacy_10morphology_PartForm_past,
__pyx_e_5spacy_10morphology_PartForm_agt,
__pyx_e_5spacy_10morphology_PartForm_neg,
__pyx_e_5spacy_10morphology_PartType_mod,
__pyx_e_5spacy_10morphology_PartType_emp,
__pyx_e_5spacy_10morphology_PartType_res,
__pyx_e_5spacy_10morphology_PartType_inf,
__pyx_e_5spacy_10morphology_PartType_vbp,
__pyx_e_5spacy_10morphology_Person_abs_one,
__pyx_e_5spacy_10morphology_Person_abs_two,
__pyx_e_5spacy_10morphology_Person_abs_three,
__pyx_e_5spacy_10morphology_Person_dat_one,
__pyx_e_5spacy_10morphology_Person_dat_two,
__pyx_e_5spacy_10morphology_Person_dat_three,
__pyx_e_5spacy_10morphology_Person_erg_one,
__pyx_e_5spacy_10morphology_Person_erg_two,
__pyx_e_5spacy_10morphology_Person_erg_three,
__pyx_e_5spacy_10morphology_Person_psor_one,
__pyx_e_5spacy_10morphology_Person_psor_two,
__pyx_e_5spacy_10morphology_Person_psor_three,
__pyx_e_5spacy_10morphology_Polite_inf,
__pyx_e_5spacy_10morphology_Polite_pol,
__pyx_e_5spacy_10morphology_Polite_abs_inf,
__pyx_e_5spacy_10morphology_Polite_abs_pol,
__pyx_e_5spacy_10morphology_Polite_erg_inf,
__pyx_e_5spacy_10morphology_Polite_erg_pol,
__pyx_e_5spacy_10morphology_Polite_dat_inf,
__pyx_e_5spacy_10morphology_Polite_dat_pol,
__pyx_e_5spacy_10morphology_Prefix_yes,
__pyx_e_5spacy_10morphology_PrepCase_npr,
__pyx_e_5spacy_10morphology_PrepCase_pre,
__pyx_e_5spacy_10morphology_PunctSide_ini,
__pyx_e_5spacy_10morphology_PunctSide_fin,
__pyx_e_5spacy_10morphology_PunctType_peri,
__pyx_e_5spacy_10morphology_PunctType_qest,
__pyx_e_5spacy_10morphology_PunctType_excl,
__pyx_e_5spacy_10morphology_PunctType_quot,
__pyx_e_5spacy_10morphology_PunctType_brck,
__pyx_e_5spacy_10morphology_PunctType_comm,
__pyx_e_5spacy_10morphology_PunctType_colo,
__pyx_e_5spacy_10morphology_PunctType_semi,
__pyx_e_5spacy_10morphology_PunctType_dash,
__pyx_e_5spacy_10morphology_Style_arch,
__pyx_e_5spacy_10morphology_Style_rare,
__pyx_e_5spacy_10morphology_Style_poet,
__pyx_e_5spacy_10morphology_Style_norm,
__pyx_e_5spacy_10morphology_Style_coll,
__pyx_e_5spacy_10morphology_Style_vrnc,
__pyx_e_5spacy_10morphology_Style_sing,
__pyx_e_5spacy_10morphology_Style_expr,
__pyx_e_5spacy_10morphology_Style_derg,
__pyx_e_5spacy_10morphology_Style_vulg,
__pyx_e_5spacy_10morphology_Style_yes,
__pyx_e_5spacy_10morphology_StyleVariant_styleShort,
__pyx_e_5spacy_10morphology_StyleVariant_styleBound,
__pyx_e_5spacy_10morphology_VerbType_aux,
__pyx_e_5spacy_10morphology_VerbType_cop,
__pyx_e_5spacy_10morphology_VerbType_mod,
__pyx_e_5spacy_10morphology_VerbType_light
};
/* "spacy\morphology.pxd":13
*
*
* cdef struct RichTagC: # <<<<<<<<<<<<<<
* uint64_t morph
* int id
*/
struct __pyx_t_5spacy_10morphology_RichTagC {
uint64_t morph;
int id;
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos;
__pyx_t_5spacy_8typedefs_attr_t name;
};
/* "spacy\morphology.pxd":20
*
*
* cdef struct MorphAnalysisC: # <<<<<<<<<<<<<<
* RichTagC tag
* attr_t lemma
*/
struct __pyx_t_5spacy_10morphology_MorphAnalysisC {
struct __pyx_t_5spacy_10morphology_RichTagC tag;
__pyx_t_5spacy_8typedefs_attr_t lemma;
};
/* "cymem\cymem.pxd":1
* cdef class Pool: # <<<<<<<<<<<<<<
* cdef readonly size_t size
* cdef readonly dict addresses
*/
struct __pyx_obj_5cymem_5cymem_Pool {
PyObject_HEAD
struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab;
size_t size;
PyObject *addresses;
PyObject *refs;
};
/* "cymem\cymem.pxd":11
*
*
* cdef class Address: # <<<<<<<<<<<<<<
* cdef void* ptr
*/
struct __pyx_obj_5cymem_5cymem_Address {
PyObject_HEAD
void *ptr;
};
/* "preshed\maps.pxd":36
*
*
* cdef class PreshMap: # <<<<<<<<<<<<<<
* cdef MapStruct* c_map
* cdef Pool mem
*/
struct __pyx_obj_7preshed_4maps_PreshMap {
PyObject_HEAD
struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab;
struct __pyx_t_7preshed_4maps_MapStruct *c_map;
struct __pyx_obj_5cymem_5cymem_Pool *mem;
};
/* "preshed\maps.pxd":44
*
*
* cdef class PreshMapArray: # <<<<<<<<<<<<<<
* cdef Pool mem
* cdef MapStruct* maps
*/
struct __pyx_obj_7preshed_4maps_PreshMapArray {
PyObject_HEAD
struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab;
struct __pyx_obj_5cymem_5cymem_Pool *mem;
struct __pyx_t_7preshed_4maps_MapStruct *maps;
size_t length;
};
/* "strings.pxd":18
*
*
* cdef class StringStore: # <<<<<<<<<<<<<<
* cdef Pool mem
* cdef Utf8Str* c
*/
struct __pyx_obj_5spacy_7strings_StringStore {
PyObject_HEAD
struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab;
struct __pyx_obj_5cymem_5cymem_Pool *mem;
__pyx_t_5spacy_7strings_Utf8Str *c;
int64_t size;
int is_frozen;
struct __pyx_obj_7preshed_4maps_PreshMap *_map;
struct __pyx_obj_7preshed_4maps_PreshMap *_oov;
int64_t _resize_at;
};
/* "vocab.pxd":27
*
*
* cdef class Vocab: # <<<<<<<<<<<<<<
* cdef Pool mem
* cpdef readonly StringStore strings
*/
struct __pyx_obj_5spacy_5vocab_Vocab {
PyObject_HEAD
struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab;
struct __pyx_obj_5cymem_5cymem_Pool *mem;
struct __pyx_obj_5spacy_7strings_StringStore *strings;
struct __pyx_obj_5spacy_10morphology_Morphology *morphology;
int length;
PyObject *_serializer;
PyObject *data_dir;
PyObject *lex_attr_getters;
PyObject *serializer_freqs;
struct __pyx_obj_7preshed_4maps_PreshMap *_by_hash;
struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth;
int vectors_length;
};
/* "lexeme.pxd":14
* cdef LexemeC EMPTY_LEXEME
*
* cdef class Lexeme: # <<<<<<<<<<<<<<
* cdef LexemeC* c
* cdef readonly Vocab vocab
*/
struct __pyx_obj_5spacy_6lexeme_Lexeme {
PyObject_HEAD
struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab;
struct __pyx_t_5spacy_7structs_LexemeC *c;
struct __pyx_obj_5spacy_5vocab_Vocab *vocab;
__pyx_t_5spacy_8typedefs_attr_t orth;
};
/* "spacy\morphology.pxd":25
*
*
* cdef class Morphology: # <<<<<<<<<<<<<<
* cdef readonly Pool mem
* cdef readonly StringStore strings
*/
struct __pyx_obj_5spacy_10morphology_Morphology {
PyObject_HEAD
struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab;
struct __pyx_obj_5cymem_5cymem_Pool *mem;
struct __pyx_obj_5spacy_7strings_StringStore *strings;
PyObject *lemmatizer;
PyObject *tag_map;
PyObject *n_tags;
PyObject *reverse_index;
PyObject *tag_names;
struct __pyx_t_5spacy_10morphology_RichTagC *rich_tags;
struct __pyx_obj_7preshed_4maps_PreshMapArray *_cache;
};
/* "cymem\cymem.pxd":1
* cdef class Pool: # <<<<<<<<<<<<<<
* cdef readonly size_t size
* cdef readonly dict addresses
*/
struct __pyx_vtabstruct_5cymem_5cymem_Pool {
void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t);
void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *);
void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t);
};
static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool;
/* "preshed\maps.pxd":36
*
*
* cdef class PreshMap: # <<<<<<<<<<<<<<
* cdef MapStruct* c_map
* cdef Pool mem
*/
struct __pyx_vtabstruct_7preshed_4maps_PreshMap {
void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t);
void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *);
};
static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap;
/* "preshed\maps.pxd":44
*
*
* cdef class PreshMapArray: # <<<<<<<<<<<<<<
* cdef Pool mem
* cdef MapStruct* maps
*/
struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray {
void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t);
void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *);
};
static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray;
/* "strings.pxd":18
*
*
* cdef class StringStore: # <<<<<<<<<<<<<<
* cdef Pool mem
* cdef Utf8Str* c
*/
struct __pyx_vtabstruct_5spacy_7strings_StringStore {
__pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *);
__pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int);
};
static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore;
/* "vocab.pxd":27
*
*
* cdef class Vocab: # <<<<<<<<<<<<<<
* cdef Pool mem
* cpdef readonly StringStore strings
*/
struct __pyx_vtabstruct_5spacy_5vocab_Vocab {
struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *);
struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t);
struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *);
struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *);
int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *);
};
static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab;
/* "lexeme.pxd":14
* cdef LexemeC EMPTY_LEXEME
*
* cdef class Lexeme: # <<<<<<<<<<<<<<
* cdef LexemeC* c
* cdef readonly Vocab vocab
*/
struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme {
struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *, int);
void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t);
__pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t);
int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t);
int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int);
};
static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme;
static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *, int);
static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t);
static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t);
static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t);
static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int);
/* "spacy\morphology.pyx":35
*
*
* cdef class Morphology: # <<<<<<<<<<<<<<
* def __init__(self, StringStore string_store, tag_map, lemmatizer):
* self.mem = Pool()
*/
struct __pyx_vtabstruct_5spacy_10morphology_Morphology {
int (*assign_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_TokenC *, PyObject *);
int (*assign_tag_id)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_TokenC *, int);
int (*assign_feature)(struct __pyx_obj_5spacy_10morphology_Morphology *, uint64_t *, enum __pyx_t_5spacy_10morphology_univ_morph_t, int);
};
static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology;
/* --- Runtime support code (head) --- */
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
if (acquire_gil) {\
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
PyGILState_Release(__pyx_gilstate_save);\
} else {\
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext()\
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
PyObject *tmp = (PyObject *) r;\
r = v; __Pyx_XDECREF(tmp);\
} while (0)
#define __Pyx_DECREF_SET(r, v) do {\
PyObject *tmp = (PyObject *) r;\
r = v; __Pyx_DECREF(tmp);\
} while (0)
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
PyTypeObject* tp = Py_TYPE(obj);
if (likely(tp->tp_getattro))
return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
if (likely(tp->tp_getattr))
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list, int wraparound, int boundscheck);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE int __Pyx_IterFinish(void);
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
int result = PySequence_Contains(seq, item);
return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}
#include <string.h>
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
const char* function_name);
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact);
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
(inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
(is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
__Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
int is_list, int wraparound, int boundscheck);
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
typedef struct {
PyObject *type;
PyObject **method_name;
PyCFunction func;
PyObject *method;
int flag;
} __Pyx_CachedCFunction;
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
((likely((cfunc)->func)) ?\
(likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\
(likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) : __Pyx__CallUnboundCMethod0(cfunc, self)))) :\
__Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
#endif
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
PyObject *value;
value = PyDict_GetItemWithError(d, key);
if (unlikely(!value)) {
if (!PyErr_Occurred()) {
PyObject* args = PyTuple_Pack(1, key);
if (likely(args))
PyErr_SetObject(PyExc_KeyError, args);
Py_XDECREF(args);
}
return NULL;
}
Py_INCREF(value);
return value;
}
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL)
static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
return (PyObject*) (((PyTypeObject*)type_obj)->tp_new((PyTypeObject*)type_obj, args, kwargs));
}
static int __Pyx_SetVtable(PyObject *dict, void *vtable);
static void* __Pyx_GetVtable(PyObject *dict);
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
#define __Pyx_CYFUNCTION_CCLASS 0x04
#define __Pyx_CyFunction_GetClosure(f)\
(((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
(((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
PyObject *func_weakreflist;
#endif
PyObject *func_dict;
PyObject *func_name;
PyObject *func_qualname;
PyObject *func_doc;
PyObject *func_globals;
PyObject *func_code;
PyObject *func_closure;
PyObject *func_classobj;
void *defaults;
int defaults_pyobjects;
int flags;
PyObject *defaults_tuple;
PyObject *defaults_kwdict;
PyObject *(*defaults_getter)(PyObject *);
PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
int flags, PyObject* qualname,
PyObject *self,
PyObject *module, PyObject *globals,
PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
size_t size,
int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
PyObject *dict);
static int __pyx_CyFunction_init(void);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len)) {
Py_INCREF(x);
PyList_SET_ITEM(list, len, x);
Py_SIZE(list) = len+1;
return 0;
}
return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename);
static CYTHON_INLINE enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __Pyx_PyInt_As_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PyObject *);
static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(enum __pyx_t_5spacy_10morphology_univ_morph_t value);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value);
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t value);
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
static CYTHON_INLINE enum __pyx_t_5spacy_10morphology_univ_morph_t __Pyx_PyInt_As_enum____pyx_t_5spacy_10morphology_univ_morph_t(PyObject *);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
#define __Pyx_CREAL(z) ((z).real())
#define __Pyx_CIMAG(z) ((z).imag())
#else
#define __Pyx_CREAL(z) (__real__(z))
#define __Pyx_CIMAG(z) (__imag__(z))
#endif
#else
#define __Pyx_CREAL(z) ((z).real)
#define __Pyx_CIMAG(z) ((z).imag)
#endif
#if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
#define __Pyx_SET_CREAL(z,x) ((z).real(x))
#define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
#define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
#define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
#if CYTHON_CCOMPLEX
#define __Pyx_c_eqf(a, b) ((a)==(b))
#define __Pyx_c_sumf(a, b) ((a)+(b))
#define __Pyx_c_difff(a, b) ((a)-(b))
#define __Pyx_c_prodf(a, b) ((a)*(b))
#define __Pyx_c_quotf(a, b) ((a)/(b))
#define __Pyx_c_negf(a) (-(a))
#ifdef __cplusplus
#define __Pyx_c_is_zerof(z) ((z)==(float)0)
#define __Pyx_c_conjf(z) (::std::conj(z))
#if 1
#define __Pyx_c_absf(z) (::std::abs(z))
#define __Pyx_c_powf(a, b) (::std::pow(a, b))
#endif
#else
#define __Pyx_c_is_zerof(z) ((z)==0)
#define __Pyx_c_conjf(z) (conjf(z))
#if 1
#define __Pyx_c_absf(z) (cabsf(z))
#define __Pyx_c_powf(a, b) (cpowf(a, b))
#endif
#endif
#else
static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
#if 1
static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
#endif
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
#if CYTHON_CCOMPLEX
#define __Pyx_c_eq(a, b) ((a)==(b))
#define __Pyx_c_sum(a, b) ((a)+(b))
#define __Pyx_c_diff(a, b) ((a)-(b))
#define __Pyx_c_prod(a, b) ((a)*(b))
#define __Pyx_c_quot(a, b) ((a)/(b))
#define __Pyx_c_neg(a) (-(a))
#ifdef __cplusplus
#define __Pyx_c_is_zero(z) ((z)==(double)0)
#define __Pyx_c_conj(z) (::std::conj(z))
#if 1
#define __Pyx_c_abs(z) (::std::abs(z))
#define __Pyx_c_pow(a, b) (::std::pow(a, b))
#endif
#else
#define __Pyx_c_is_zero(z) ((z)==0)
#define __Pyx_c_conj(z) (conj(z))
#if 1
#define __Pyx_c_abs(z) (cabs(z))
#define __Pyx_c_pow(a, b) (cpow(a, b))
#endif
#endif
#else
static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
#if 1
static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
#endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
static int __Pyx_check_binary_version(void);
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif
static PyObject *__Pyx_ImportModule(const char *name);
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
static int __pyx_f_5spacy_10morphology_10Morphology_assign_tag(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, PyObject *__pyx_v_tag); /* proto*/
static int __pyx_f_5spacy_10morphology_10Morphology_assign_tag_id(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, int __pyx_v_tag_id); /* proto*/
static int __pyx_f_5spacy_10morphology_10Morphology_assign_feature(CYTHON_UNUSED struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, uint64_t *__pyx_v_flags, enum __pyx_t_5spacy_10morphology_univ_morph_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/
static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, CYTHON_UNUSED int __pyx_v_vector_length); /* proto*/
static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/
static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/
static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/
static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/
/* Module declarations from 'cymem.cymem' */
static PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool = 0;
static PyTypeObject *__pyx_ptype_5cymem_5cymem_Address = 0;
/* Module declarations from 'libc.stdint' */
/* Module declarations from 'preshed.maps' */
static PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap = 0;
static PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray = 0;
/* Module declarations from 'spacy.typedefs' */
/* Module declarations from 'spacy' */
/* Module declarations from 'spacy.symbols' */
/* Module declarations from 'spacy.parts_of_speech' */
/* Module declarations from 'spacy.structs' */
/* Module declarations from 'murmurhash.mrmr' */
static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/
/* Module declarations from 'spacy.strings' */
static PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore = 0;
/* Module declarations from 'libc.string' */
/* Module declarations from 'spacy.attrs' */
/* Module declarations from 'libcpp.vector' */
/* Module declarations from 'spacy.vocab' */
static PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab = 0;
static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0;
#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME)
/* Module declarations from 'cpython.buffer' */
/* Module declarations from 'libc.stdio' */
/* Module declarations from '__builtin__' */
/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
/* Module declarations from 'cpython' */
/* Module declarations from 'cpython.object' */
/* Module declarations from 'cpython.ref' */
/* Module declarations from 'libc.stdlib' */
/* Module declarations from 'numpy' */
/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
/* Module declarations from 'spacy.lexeme' */
static PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme = 0;
static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0;
#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME)
/* Module declarations from 'spacy.morphology' */
static PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology = 0;
#define __Pyx_MODULE_NAME "spacy.morphology"
int __pyx_module_is_main_spacy__morphology = 0;
/* Implementation of 'spacy.morphology' */
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_B[] = "B";
static char __pyx_k_H[] = "H";
static char __pyx_k_I[] = "I";
static char __pyx_k_L[] = "L";
static char __pyx_k_O[] = "O";
static char __pyx_k_Q[] = "Q";
static char __pyx_k_b[] = "b";
static char __pyx_k_d[] = "d";
static char __pyx_k_f[] = "f";
static char __pyx_k_g[] = "g";
static char __pyx_k_h[] = "h";
static char __pyx_k_i[] = "i";
static char __pyx_k_l[] = "l";
static char __pyx_k_q[] = "q";
static char __pyx_k_SP[] = "SP";
static char __pyx_k_Zd[] = "Zd";
static char __pyx_k_Zf[] = "Zf";
static char __pyx_k_Zg[] = "Zg";
static char __pyx_k_IDS[] = "IDS";
static char __pyx_k_get[] = "get";
static char __pyx_k_key[] = "key";
static char __pyx_k_out[] = "out";
static char __pyx_k_pos[] = "pos";
static char __pyx_k_keys[] = "keys";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_orth[] = "orth";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_LEMMA[] = "LEMMA";
static char __pyx_k_NAMES[] = "NAMES";
static char __pyx_k_attrs[] = "attrs";
static char __pyx_k_force[] = "force";
static char __pyx_k_items[] = "items";
static char __pyx_k_lower[] = "lower";
static char __pyx_k_props[] = "props";
static char __pyx_k_range[] = "range";
static char __pyx_k_upper[] = "upper";
static char __pyx_k_value[] = "value";
static char __pyx_k_Mood_n[] = "Mood_n";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_lambda[] = "<lambda>";
static char __pyx_k_sorted[] = "sorted";
static char __pyx_k_POS_IDS[] = "POS_IDS";
static char __pyx_k_tag_map[] = "tag_map";
static char __pyx_k_tag_str[] = "tag_str";
static char __pyx_k_Abbr_yes[] = "Abbr_yes ";
static char __pyx_k_Case_abe[] = "Case_abe";
static char __pyx_k_Case_abl[] = "Case_abl";
static char __pyx_k_Case_abs[] = "Case_abs";
static char __pyx_k_Case_acc[] = "Case_acc";
static char __pyx_k_Case_ade[] = "Case_ade";
static char __pyx_k_Case_all[] = "Case_all";
static char __pyx_k_Case_cau[] = "Case_cau";
static char __pyx_k_Case_com[] = "Case_com";
static char __pyx_k_Case_dat[] = "Case_dat";
static char __pyx_k_Case_del[] = "Case_del";
static char __pyx_k_Case_dis[] = "Case_dis";
static char __pyx_k_Case_ela[] = "Case_ela";
static char __pyx_k_Case_ess[] = "Case_ess";
static char __pyx_k_Case_gen[] = "Case_gen";
static char __pyx_k_Case_ill[] = "Case_ill";
static char __pyx_k_Case_ine[] = "Case_ine";
static char __pyx_k_Case_ins[] = "Case_ins";
static char __pyx_k_Case_lat[] = "Case_lat";
static char __pyx_k_Case_loc[] = "Case_loc";
static char __pyx_k_Case_nom[] = "Case_nom";
static char __pyx_k_Case_par[] = "Case_par";
static char __pyx_k_Case_sub[] = "Case_sub";
static char __pyx_k_Case_sup[] = "Case_sup";
static char __pyx_k_Case_tem[] = "Case_tem";
static char __pyx_k_Case_ter[] = "Case_ter";
static char __pyx_k_Case_tra[] = "Case_tra";
static char __pyx_k_Case_voc[] = "Case_voc";
static char __pyx_k_Echo_ech[] = "Echo_ech ";
static char __pyx_k_Echo_rdp[] = "Echo_rdp ";
static char __pyx_k_Hyph_yes[] = "Hyph_yes ";
static char __pyx_k_Mood_cnd[] = "Mood_cnd";
static char __pyx_k_Mood_imp[] = "Mood_imp";
static char __pyx_k_Mood_ind[] = "Mood_ind";
static char __pyx_k_Mood_opt[] = "Mood_opt";
static char __pyx_k_Mood_pot[] = "Mood_pot";
static char __pyx_k_Mood_sub[] = "Mood_sub";
static char __pyx_k_Poss_yes[] = "Poss_yes";
static char __pyx_k_orth_str[] = "orth_str";
static char __pyx_k_univ_pos[] = "univ_pos";
static char __pyx_k_Style_yes[] = "Style_yes ";
static char __pyx_k_Tense_fut[] = "Tense_fut";
static char __pyx_k_Tense_imp[] = "Tense_imp";
static char __pyx_k_Voice_act[] = "Voice_act";
static char __pyx_k_Voice_cau[] = "Voice_cau";
static char __pyx_k_Voice_int[] = "Voice_int ";
static char __pyx_k_Voice_mid[] = "Voice_mid ";
static char __pyx_k_enumerate[] = "enumerate";
static char __pyx_k_lemmatize[] = "lemmatize";
static char __pyx_k_AdvType_ex[] = "AdvType_ex";
static char __pyx_k_Aspect_imp[] = "Aspect_imp";
static char __pyx_k_Aspect_mod[] = "Aspect_mod";
static char __pyx_k_Degree_abs[] = "Degree_abs";
static char __pyx_k_Degree_cmp[] = "Degree_cmp";
static char __pyx_k_Degree_com[] = "Degree_com";
static char __pyx_k_Degree_dim[] = "Degree_dim ";
static char __pyx_k_Degree_pos[] = "Degree_pos";
static char __pyx_k_Degree_sup[] = "Degree_sup";
static char __pyx_k_Gender_com[] = "Gender_com";
static char __pyx_k_Gender_fem[] = "Gender_fem";
static char __pyx_k_Number_com[] = "Number_com";
static char __pyx_k_Person_one[] = "Person_one";
static char __pyx_k_Person_two[] = "Person_two";
static char __pyx_k_Polite_inf[] = "Polite_inf ";
static char __pyx_k_Polite_pol[] = "Polite_pol ";
static char __pyx_k_Prefix_yes[] = "Prefix_yes ";
static char __pyx_k_Reflex_yes[] = "Reflex_yes";
static char __pyx_k_Style_arch[] = "Style_arch ";
static char __pyx_k_Style_coll[] = "Style_coll ";
static char __pyx_k_Style_derg[] = "Style_derg ";
static char __pyx_k_Style_expr[] = "Style_expr ";
static char __pyx_k_Style_norm[] = "Style_norm ";
static char __pyx_k_Style_poet[] = "Style_poet ";
static char __pyx_k_Style_rare[] = "Style_rare ";
static char __pyx_k_Style_sing[] = "Style_sing ";
static char __pyx_k_Style_vrnc[] = "Style_vrnc ";
static char __pyx_k_Style_vulg[] = "Style_vulg ";
static char __pyx_k_Tense_past[] = "Tense_past";
static char __pyx_k_Tense_pres[] = "Tense_pres";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_Voice_pass[] = "Voice_pass";
static char __pyx_k_lemmatizer[] = "lemmatizer";
static char __pyx_k_morphology[] = "morphology";
static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static char __pyx_k_AdpType_voc[] = "AdpType_voc ";
static char __pyx_k_AdvType_cau[] = "AdvType_cau";
static char __pyx_k_AdvType_deg[] = "AdvType_deg";
static char __pyx_k_AdvType_loc[] = "AdvType_loc";
static char __pyx_k_AdvType_man[] = "AdvType_man";
static char __pyx_k_AdvType_mod[] = "AdvType_mod";
static char __pyx_k_AdvType_sta[] = "AdvType_sta";
static char __pyx_k_AdvType_tim[] = "AdvType_tim";
static char __pyx_k_Aspect_freq[] = "Aspect_freq";
static char __pyx_k_Aspect_none[] = "Aspect_none";
static char __pyx_k_Aspect_perf[] = "Aspect_perf";
static char __pyx_k_Degree_comp[] = "Degree_comp";
static char __pyx_k_Degree_none[] = "Degree_none";
static char __pyx_k_Foreign_yes[] = "Foreign_yes ";
static char __pyx_k_Gender_masc[] = "Gender_masc";
static char __pyx_k_Gender_neut[] = "Gender_neut";
static char __pyx_k_InfForm_one[] = "InfForm_one ";
static char __pyx_k_InfForm_two[] = "InfForm_two ";
static char __pyx_k_NumType_gen[] = "NumType_gen";
static char __pyx_k_NumType_ord[] = "NumType_ord";
static char __pyx_k_Number_dual[] = "Number_dual";
static char __pyx_k_Number_none[] = "Number_none";
static char __pyx_k_Number_plur[] = "Number_plur";
static char __pyx_k_Number_ptan[] = "Number_ptan ";
static char __pyx_k_Number_sing[] = "Number_sing";
static char __pyx_k_Person_none[] = "Person_none";
static char __pyx_k_AdpType_circ[] = "AdpType_circ ";
static char __pyx_k_AdpType_post[] = "AdpType_post ";
static char __pyx_k_AdpType_prep[] = "AdpType_prep ";
static char __pyx_k_Animacy_anim[] = "Animacy_anim";
static char __pyx_k_Animacy_inam[] = "Animacy_inam";
static char __pyx_k_Definite_def[] = "Definite_def";
static char __pyx_k_Definite_ind[] = "Definite_ind";
static char __pyx_k_Definite_red[] = "Definite_red";
static char __pyx_k_Definite_two[] = "Definite_two";
static char __pyx_k_NameType_com[] = "NameType_com ";
static char __pyx_k_NameType_geo[] = "NameType_geo ";
static char __pyx_k_NameType_giv[] = "NameType_giv ";
static char __pyx_k_NameType_nat[] = "NameType_nat ";
static char __pyx_k_NameType_oth[] = "NameType_oth ";
static char __pyx_k_NameType_pro[] = "NameType_pro ";
static char __pyx_k_NameType_prs[] = "NameType_prs ";
static char __pyx_k_NameType_sur[] = "NameType_sur ";
static char __pyx_k_Negative_neg[] = "Negative_neg";
static char __pyx_k_Negative_pos[] = "Negative_pos";
static char __pyx_k_Negative_yes[] = "Negative_yes";
static char __pyx_k_NounType_com[] = "NounType_com ";
static char __pyx_k_NumForm_word[] = "NumForm_word ";
static char __pyx_k_NumType_card[] = "NumType_card";
static char __pyx_k_NumType_dist[] = "NumType_dist";
static char __pyx_k_NumType_frac[] = "NumType_frac";
static char __pyx_k_NumType_mult[] = "NumType_mult";
static char __pyx_k_NumType_none[] = "NumType_none";
static char __pyx_k_NumType_sets[] = "NumType_sets";
static char __pyx_k_NumValue_one[] = "NumValue_one ";
static char __pyx_k_NumValue_two[] = "NumValue_two ";
static char __pyx_k_Number_count[] = "Number_count ";
static char __pyx_k_PartForm_agt[] = "PartForm_agt ";
static char __pyx_k_PartForm_neg[] = "PartForm_neg ";
static char __pyx_k_PartType_emp[] = "PartType_emp ";
static char __pyx_k_PartType_inf[] = "PartType_inf ";
static char __pyx_k_PartType_mod[] = "PartType_mod ";
static char __pyx_k_PartType_res[] = "PartType_res ";
static char __pyx_k_PartType_vbp[] = "PartType_vbp ";
static char __pyx_k_Person_three[] = "Person_three";
static char __pyx_k_Polarity_neg[] = "Polarity_neg";
static char __pyx_k_Polarity_pos[] = "Polarity_pos";
static char __pyx_k_PrepCase_npr[] = "PrepCase_npr ";
static char __pyx_k_PrepCase_pre[] = "PrepCase_pre ";
static char __pyx_k_PronType_art[] = "PronType_art";
static char __pyx_k_PronType_dem[] = "PronType_dem";
static char __pyx_k_PronType_exc[] = "PronType_exc ";
static char __pyx_k_PronType_ind[] = "PronType_ind";
static char __pyx_k_PronType_int[] = "PronType_int";
static char __pyx_k_PronType_neg[] = "PronType_neg";
static char __pyx_k_PronType_prs[] = "PronType_prs";
static char __pyx_k_PronType_rcp[] = "PronType_rcp";
static char __pyx_k_PronType_rel[] = "PronType_rel";
static char __pyx_k_PronType_tot[] = "PronType_tot";
static char __pyx_k_RuntimeError[] = "RuntimeError";
static char __pyx_k_VerbForm_fin[] = "VerbForm_fin";
static char __pyx_k_VerbForm_gdv[] = "VerbForm_gdv ";
static char __pyx_k_VerbForm_ger[] = "VerbForm_ger";
static char __pyx_k_VerbForm_inf[] = "VerbForm_inf";
static char __pyx_k_VerbForm_sup[] = "VerbForm_sup";
static char __pyx_k_VerbType_aux[] = "VerbType_aux ";
static char __pyx_k_VerbType_cop[] = "VerbType_cop ";
static char __pyx_k_VerbType_mod[] = "VerbType_mod ";
static char __pyx_k_intify_attrs[] = "intify_attrs";
static char __pyx_k_string_store[] = "string_store";
static char __pyx_k_AdvType_adadj[] = "AdvType_adadj";
static char __pyx_k_ConjType_comp[] = "ConjType_comp ";
static char __pyx_k_ConjType_oper[] = "ConjType_oper ";
static char __pyx_k_Definite_cons[] = "Definite_cons";
static char __pyx_k_Derivation_ja[] = "Derivation_ja ";
static char __pyx_k_Derivation_vs[] = "Derivation_vs ";
static char __pyx_k_InfForm_three[] = "InfForm_three ";
static char __pyx_k_NounType_prop[] = "NounType_prop ";
static char __pyx_k_NumForm_digit[] = "NumForm_digit ";
static char __pyx_k_NumForm_roman[] = "NumForm_roman ";
static char __pyx_k_PartForm_past[] = "PartForm_past ";
static char __pyx_k_PartForm_pres[] = "PartForm_pres ";
static char __pyx_k_PronType_clit[] = "PronType_clit";
static char __pyx_k_PunctSide_fin[] = "PunctSide_fin ";
static char __pyx_k_PunctSide_ini[] = "PunctSide_ini ";
static char __pyx_k_VerbForm_conv[] = "VerbForm_conv";
static char __pyx_k_VerbForm_none[] = "VerbForm_none";
static char __pyx_k_VerbForm_part[] = "VerbForm_part";
static char __pyx_k_do_deprecated[] = "_do_deprecated";
static char __pyx_k_Derivation_sti[] = "Derivation_sti ";
static char __pyx_k_Derivation_ton[] = "Derivation_ton ";
static char __pyx_k_Gender_dat_fem[] = "Gender_dat_fem ";
static char __pyx_k_Gender_erg_fem[] = "Gender_erg_fem ";
static char __pyx_k_NounType_class[] = "NounType_class ";
static char __pyx_k_NumValue_three[] = "NumValue_three ";
static char __pyx_k_Person_abs_one[] = "Person_abs_one ";
static char __pyx_k_Person_abs_two[] = "Person_abs_two ";
static char __pyx_k_Person_dat_one[] = "Person_dat_one ";
static char __pyx_k_Person_dat_two[] = "Person_dat_two ";
static char __pyx_k_Person_erg_one[] = "Person_erg_one ";
static char __pyx_k_Person_erg_two[] = "Person_erg_two ";
static char __pyx_k_Polite_abs_inf[] = "Polite_abs_inf ";
static char __pyx_k_Polite_abs_pol[] = "Polite_abs_pol ";
static char __pyx_k_Polite_dat_inf[] = "Polite_dat_inf ";
static char __pyx_k_Polite_dat_pol[] = "Polite_dat_pol ";
static char __pyx_k_Polite_erg_inf[] = "Polite_erg_inf ";
static char __pyx_k_Polite_erg_pol[] = "Polite_erg_pol ";
static char __pyx_k_PunctType_brck[] = "PunctType_brck ";
static char __pyx_k_PunctType_colo[] = "PunctType_colo ";
static char __pyx_k_PunctType_comm[] = "PunctType_comm ";
static char __pyx_k_PunctType_dash[] = "PunctType_dash ";
static char __pyx_k_PunctType_excl[] = "PunctType_excl ";
static char __pyx_k_PunctType_peri[] = "PunctType_peri ";
static char __pyx_k_PunctType_qest[] = "PunctType_qest ";
static char __pyx_k_PunctType_quot[] = "PunctType_quot ";
static char __pyx_k_PunctType_semi[] = "PunctType_semi ";
static char __pyx_k_VerbForm_trans[] = "VerbForm_trans";
static char __pyx_k_VerbType_light[] = "VerbType_light ";
static char __pyx_k_AdpType_comprep[] = "AdpType_comprep ";
static char __pyx_k_Connegative_yes[] = "Connegative_yes ";
static char __pyx_k_Derivation_inen[] = "Derivation_inen ";
static char __pyx_k_Derivation_ttaa[] = "Derivation_ttaa ";
static char __pyx_k_Foreign_foreign[] = "Foreign_foreign ";
static char __pyx_k_Foreign_fscript[] = "Foreign_fscript ";
static char __pyx_k_Foreign_tscript[] = "Foreign_tscript ";
static char __pyx_k_Gender_dat_masc[] = "Gender_dat_masc ";
static char __pyx_k_Gender_erg_masc[] = "Gender_erg_masc ";
static char __pyx_k_Gender_psor_fem[] = "Gender_psor_fem ";
static char __pyx_k_Number_abs_plur[] = "Number_abs_plur ";
static char __pyx_k_Number_abs_sing[] = "Number_abs_sing ";
static char __pyx_k_Number_dat_plur[] = "Number_dat_plur ";
static char __pyx_k_Number_dat_sing[] = "Number_dat_sing ";
static char __pyx_k_Number_erg_plur[] = "Number_erg_plur ";
static char __pyx_k_Number_erg_sing[] = "Number_erg_sing ";
static char __pyx_k_Person_psor_one[] = "Person_psor_one ";
static char __pyx_k_Person_psor_two[] = "Person_psor_two ";
static char __pyx_k_normalize_props[] = "_normalize_props";
static char __pyx_k_parts_of_speech[] = "parts_of_speech";
static char __pyx_k_Derivation_minen[] = "Derivation_minen ";
static char __pyx_k_Derivation_ttain[] = "Derivation_ttain ";
static char __pyx_k_Gender_psor_masc[] = "Gender_psor_masc ";
static char __pyx_k_Gender_psor_neut[] = "Gender_psor_neut ";
static char __pyx_k_Number_psee_plur[] = "Number_psee_plur ";
static char __pyx_k_Number_psee_sing[] = "Number_psee_sing ";
static char __pyx_k_Number_psor_plur[] = "Number_psor_plur ";
static char __pyx_k_Number_psor_sing[] = "Number_psor_sing ";
static char __pyx_k_Person_abs_three[] = "Person_abs_three ";
static char __pyx_k_Person_dat_three[] = "Person_dat_three ";
static char __pyx_k_Person_erg_three[] = "Person_erg_three ";
static char __pyx_k_PronType_advPart[] = "PronType_advPart";
static char __pyx_k_PronType_default[] = "PronType_default";
static char __pyx_k_Unknown_tag_ID_s[] = "Unknown tag ID: %s";
static char __pyx_k_VerbForm_partFut[] = "VerbForm_partFut";
static char __pyx_k_add_special_case[] = "add_special_case";
static char __pyx_k_spacy_morphology[] = "spacy.morphology";
static char __pyx_k_Derivation_lainen[] = "Derivation_lainen ";
static char __pyx_k_Person_psor_three[] = "Person_psor_three ";
static char __pyx_k_VerbForm_partPast[] = "VerbForm_partPast";
static char __pyx_k_VerbForm_partPres[] = "VerbForm_partPres";
static char __pyx_k_StyleVariant_styleBound[] = "StyleVariant_styleBound ";
static char __pyx_k_StyleVariant_styleShort[] = "StyleVariant_styleShort ";
static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_Conflicting_morphology_exception[] = "Conflicting morphology exception for (%s, %s). Use force=True to overwrite.";
static char __pyx_k_E_Twilight_Projects_Python_Spacy[] = "E:\\Twilight\\Projects\\Python\\Spacy_Wednesday\\spaCy\\spacy\\morphology.pyx";
static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_kp_u_Abbr_yes;
static PyObject *__pyx_kp_u_AdpType_circ;
static PyObject *__pyx_kp_u_AdpType_comprep;
static PyObject *__pyx_kp_u_AdpType_post;
static PyObject *__pyx_kp_u_AdpType_prep;
static PyObject *__pyx_kp_u_AdpType_voc;
static PyObject *__pyx_n_u_AdvType_adadj;
static PyObject *__pyx_n_u_AdvType_cau;
static PyObject *__pyx_n_u_AdvType_deg;
static PyObject *__pyx_n_u_AdvType_ex;
static PyObject *__pyx_n_u_AdvType_loc;
static PyObject *__pyx_n_u_AdvType_man;
static PyObject *__pyx_n_u_AdvType_mod;
static PyObject *__pyx_n_u_AdvType_sta;
static PyObject *__pyx_n_u_AdvType_tim;
static PyObject *__pyx_n_u_Animacy_anim;
static PyObject *__pyx_n_u_Animacy_inam;
static PyObject *__pyx_n_u_Aspect_freq;
static PyObject *__pyx_n_u_Aspect_imp;
static PyObject *__pyx_n_u_Aspect_mod;
static PyObject *__pyx_n_u_Aspect_none;
static PyObject *__pyx_n_u_Aspect_perf;
static PyObject *__pyx_n_u_Case_abe;
static PyObject *__pyx_n_u_Case_abl;
static PyObject *__pyx_n_u_Case_abs;
static PyObject *__pyx_n_u_Case_acc;
static PyObject *__pyx_n_u_Case_ade;
static PyObject *__pyx_n_u_Case_all;
static PyObject *__pyx_n_u_Case_cau;
static PyObject *__pyx_n_u_Case_com;
static PyObject *__pyx_n_u_Case_dat;
static PyObject *__pyx_n_u_Case_del;
static PyObject *__pyx_n_u_Case_dis;
static PyObject *__pyx_n_u_Case_ela;
static PyObject *__pyx_n_u_Case_ess;
static PyObject *__pyx_n_u_Case_gen;
static PyObject *__pyx_n_u_Case_ill;
static PyObject *__pyx_n_u_Case_ine;
static PyObject *__pyx_n_u_Case_ins;
static PyObject *__pyx_n_u_Case_lat;
static PyObject *__pyx_n_u_Case_loc;
static PyObject *__pyx_n_u_Case_nom;
static PyObject *__pyx_n_u_Case_par;
static PyObject *__pyx_n_u_Case_sub;
static PyObject *__pyx_n_u_Case_sup;
static PyObject *__pyx_n_u_Case_tem;
static PyObject *__pyx_n_u_Case_ter;
static PyObject *__pyx_n_u_Case_tra;
static PyObject *__pyx_n_u_Case_voc;
static PyObject *__pyx_kp_u_Conflicting_morphology_exception;
static PyObject *__pyx_kp_u_ConjType_comp;
static PyObject *__pyx_kp_u_ConjType_oper;
static PyObject *__pyx_kp_u_Connegative_yes;
static PyObject *__pyx_n_u_Definite_cons;
static PyObject *__pyx_n_u_Definite_def;
static PyObject *__pyx_n_u_Definite_ind;
static PyObject *__pyx_n_u_Definite_red;
static PyObject *__pyx_n_u_Definite_two;
static PyObject *__pyx_n_u_Degree_abs;
static PyObject *__pyx_n_u_Degree_cmp;
static PyObject *__pyx_n_u_Degree_com;
static PyObject *__pyx_n_u_Degree_comp;
static PyObject *__pyx_kp_u_Degree_dim;
static PyObject *__pyx_n_u_Degree_none;
static PyObject *__pyx_n_u_Degree_pos;
static PyObject *__pyx_n_u_Degree_sup;
static PyObject *__pyx_kp_u_Derivation_inen;
static PyObject *__pyx_kp_u_Derivation_ja;
static PyObject *__pyx_kp_u_Derivation_lainen;
static PyObject *__pyx_kp_u_Derivation_minen;
static PyObject *__pyx_kp_u_Derivation_sti;
static PyObject *__pyx_kp_u_Derivation_ton;
static PyObject *__pyx_kp_u_Derivation_ttaa;
static PyObject *__pyx_kp_u_Derivation_ttain;
static PyObject *__pyx_kp_u_Derivation_vs;
static PyObject *__pyx_kp_s_E_Twilight_Projects_Python_Spacy;
static PyObject *__pyx_kp_u_Echo_ech;
static PyObject *__pyx_kp_u_Echo_rdp;
static PyObject *__pyx_kp_u_Foreign_foreign;
static PyObject *__pyx_kp_u_Foreign_fscript;
static PyObject *__pyx_kp_u_Foreign_tscript;
static PyObject *__pyx_kp_u_Foreign_yes;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_u_Gender_com;
static PyObject *__pyx_kp_u_Gender_dat_fem;
static PyObject *__pyx_kp_u_Gender_dat_masc;
static PyObject *__pyx_kp_u_Gender_erg_fem;
static PyObject *__pyx_kp_u_Gender_erg_masc;
static PyObject *__pyx_n_u_Gender_fem;
static PyObject *__pyx_n_u_Gender_masc;
static PyObject *__pyx_n_u_Gender_neut;
static PyObject *__pyx_kp_u_Gender_psor_fem;
static PyObject *__pyx_kp_u_Gender_psor_masc;
static PyObject *__pyx_kp_u_Gender_psor_neut;
static PyObject *__pyx_kp_u_Hyph_yes;
static PyObject *__pyx_n_s_IDS;
static PyObject *__pyx_kp_u_InfForm_one;
static PyObject *__pyx_kp_u_InfForm_three;
static PyObject *__pyx_kp_u_InfForm_two;
static PyObject *__pyx_n_s_LEMMA;
static PyObject *__pyx_n_u_Mood_cnd;
static PyObject *__pyx_n_u_Mood_imp;
static PyObject *__pyx_n_u_Mood_ind;
static PyObject *__pyx_n_u_Mood_n;
static PyObject *__pyx_n_u_Mood_opt;
static PyObject *__pyx_n_u_Mood_pot;
static PyObject *__pyx_n_u_Mood_sub;
static PyObject *__pyx_n_s_NAMES;
static PyObject *__pyx_kp_u_NameType_com;
static PyObject *__pyx_kp_u_NameType_geo;
static PyObject *__pyx_kp_u_NameType_giv;
static PyObject *__pyx_kp_u_NameType_nat;
static PyObject *__pyx_kp_u_NameType_oth;
static PyObject *__pyx_kp_u_NameType_pro;
static PyObject *__pyx_kp_u_NameType_prs;
static PyObject *__pyx_kp_u_NameType_sur;
static PyObject *__pyx_n_u_Negative_neg;
static PyObject *__pyx_n_u_Negative_pos;
static PyObject *__pyx_n_u_Negative_yes;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_kp_u_NounType_class;
static PyObject *__pyx_kp_u_NounType_com;
static PyObject *__pyx_kp_u_NounType_prop;
static PyObject *__pyx_kp_u_NumForm_digit;
static PyObject *__pyx_kp_u_NumForm_roman;
static PyObject *__pyx_kp_u_NumForm_word;
static PyObject *__pyx_n_u_NumType_card;
static PyObject *__pyx_n_u_NumType_dist;
static PyObject *__pyx_n_u_NumType_frac;
static PyObject *__pyx_n_u_NumType_gen;
static PyObject *__pyx_n_u_NumType_mult;
static PyObject *__pyx_n_u_NumType_none;
static PyObject *__pyx_n_u_NumType_ord;
static PyObject *__pyx_n_u_NumType_sets;
static PyObject *__pyx_kp_u_NumValue_one;
static PyObject *__pyx_kp_u_NumValue_three;
static PyObject *__pyx_kp_u_NumValue_two;
static PyObject *__pyx_kp_u_Number_abs_plur;
static PyObject *__pyx_kp_u_Number_abs_sing;
static PyObject *__pyx_n_u_Number_com;
static PyObject *__pyx_kp_u_Number_count;
static PyObject *__pyx_kp_u_Number_dat_plur;
static PyObject *__pyx_kp_u_Number_dat_sing;
static PyObject *__pyx_n_u_Number_dual;
static PyObject *__pyx_kp_u_Number_erg_plur;
static PyObject *__pyx_kp_u_Number_erg_sing;
static PyObject *__pyx_n_u_Number_none;
static PyObject *__pyx_n_u_Number_plur;
static PyObject *__pyx_kp_u_Number_psee_plur;
static PyObject *__pyx_kp_u_Number_psee_sing;
static PyObject *__pyx_kp_u_Number_psor_plur;
static PyObject *__pyx_kp_u_Number_psor_sing;
static PyObject *__pyx_kp_u_Number_ptan;
static PyObject *__pyx_n_u_Number_sing;
static PyObject *__pyx_n_s_POS_IDS;
static PyObject *__pyx_kp_u_PartForm_agt;
static PyObject *__pyx_kp_u_PartForm_neg;
static PyObject *__pyx_kp_u_PartForm_past;
static PyObject *__pyx_kp_u_PartForm_pres;
static PyObject *__pyx_kp_u_PartType_emp;
static PyObject *__pyx_kp_u_PartType_inf;
static PyObject *__pyx_kp_u_PartType_mod;
static PyObject *__pyx_kp_u_PartType_res;
static PyObject *__pyx_kp_u_PartType_vbp;
static PyObject *__pyx_kp_u_Person_abs_one;
static PyObject *__pyx_kp_u_Person_abs_three;
static PyObject *__pyx_kp_u_Person_abs_two;
static PyObject *__pyx_kp_u_Person_dat_one;
static PyObject *__pyx_kp_u_Person_dat_three;
static PyObject *__pyx_kp_u_Person_dat_two;
static PyObject *__pyx_kp_u_Person_erg_one;
static PyObject *__pyx_kp_u_Person_erg_three;
static PyObject *__pyx_kp_u_Person_erg_two;
static PyObject *__pyx_n_u_Person_none;
static PyObject *__pyx_n_u_Person_one;
static PyObject *__pyx_kp_u_Person_psor_one;
static PyObject *__pyx_kp_u_Person_psor_three;
static PyObject *__pyx_kp_u_Person_psor_two;
static PyObject *__pyx_n_u_Person_three;
static PyObject *__pyx_n_u_Person_two;
static PyObject *__pyx_n_u_Polarity_neg;
static PyObject *__pyx_n_u_Polarity_pos;
static PyObject *__pyx_kp_u_Polite_abs_inf;
static PyObject *__pyx_kp_u_Polite_abs_pol;
static PyObject *__pyx_kp_u_Polite_dat_inf;
static PyObject *__pyx_kp_u_Polite_dat_pol;
static PyObject *__pyx_kp_u_Polite_erg_inf;
static PyObject *__pyx_kp_u_Polite_erg_pol;
static PyObject *__pyx_kp_u_Polite_inf;
static PyObject *__pyx_kp_u_Polite_pol;
static PyObject *__pyx_n_u_Poss_yes;
static PyObject *__pyx_kp_u_Prefix_yes;
static PyObject *__pyx_kp_u_PrepCase_npr;
static PyObject *__pyx_kp_u_PrepCase_pre;
static PyObject *__pyx_n_u_PronType_advPart;
static PyObject *__pyx_n_u_PronType_art;
static PyObject *__pyx_n_u_PronType_clit;
static PyObject *__pyx_n_u_PronType_default;
static PyObject *__pyx_n_u_PronType_dem;
static PyObject *__pyx_kp_u_PronType_exc;
static PyObject *__pyx_n_u_PronType_ind;
static PyObject *__pyx_n_u_PronType_int;
static PyObject *__pyx_n_u_PronType_neg;
static PyObject *__pyx_n_u_PronType_prs;
static PyObject *__pyx_n_u_PronType_rcp;
static PyObject *__pyx_n_u_PronType_rel;
static PyObject *__pyx_n_u_PronType_tot;
static PyObject *__pyx_kp_u_PunctSide_fin;
static PyObject *__pyx_kp_u_PunctSide_ini;
static PyObject *__pyx_kp_u_PunctType_brck;
static PyObject *__pyx_kp_u_PunctType_colo;
static PyObject *__pyx_kp_u_PunctType_comm;
static PyObject *__pyx_kp_u_PunctType_dash;
static PyObject *__pyx_kp_u_PunctType_excl;
static PyObject *__pyx_kp_u_PunctType_peri;
static PyObject *__pyx_kp_u_PunctType_qest;
static PyObject *__pyx_kp_u_PunctType_quot;
static PyObject *__pyx_kp_u_PunctType_semi;
static PyObject *__pyx_n_u_Reflex_yes;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_u_SP;
static PyObject *__pyx_kp_u_StyleVariant_styleBound;
static PyObject *__pyx_kp_u_StyleVariant_styleShort;
static PyObject *__pyx_kp_u_Style_arch;
static PyObject *__pyx_kp_u_Style_coll;
static PyObject *__pyx_kp_u_Style_derg;
static PyObject *__pyx_kp_u_Style_expr;
static PyObject *__pyx_kp_u_Style_norm;
static PyObject *__pyx_kp_u_Style_poet;
static PyObject *__pyx_kp_u_Style_rare;
static PyObject *__pyx_kp_u_Style_sing;
static PyObject *__pyx_kp_u_Style_vrnc;
static PyObject *__pyx_kp_u_Style_vulg;
static PyObject *__pyx_kp_u_Style_yes;
static PyObject *__pyx_n_u_Tense_fut;
static PyObject *__pyx_n_u_Tense_imp;
static PyObject *__pyx_n_u_Tense_past;
static PyObject *__pyx_n_u_Tense_pres;
static PyObject *__pyx_kp_u_Unknown_tag_ID_s;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_u_VerbForm_conv;
static PyObject *__pyx_n_u_VerbForm_fin;
static PyObject *__pyx_kp_u_VerbForm_gdv;
static PyObject *__pyx_n_u_VerbForm_ger;
static PyObject *__pyx_n_u_VerbForm_inf;
static PyObject *__pyx_n_u_VerbForm_none;
static PyObject *__pyx_n_u_VerbForm_part;
static PyObject *__pyx_n_u_VerbForm_partFut;
static PyObject *__pyx_n_u_VerbForm_partPast;
static PyObject *__pyx_n_u_VerbForm_partPres;
static PyObject *__pyx_n_u_VerbForm_sup;
static PyObject *__pyx_n_u_VerbForm_trans;
static PyObject *__pyx_kp_u_VerbType_aux;
static PyObject *__pyx_kp_u_VerbType_cop;
static PyObject *__pyx_kp_u_VerbType_light;
static PyObject *__pyx_kp_u_VerbType_mod;
static PyObject *__pyx_n_u_Voice_act;
static PyObject *__pyx_n_u_Voice_cau;
static PyObject *__pyx_kp_u_Voice_int;
static PyObject *__pyx_kp_u_Voice_mid;
static PyObject *__pyx_n_u_Voice_pass;
static PyObject *__pyx_n_s_add_special_case;
static PyObject *__pyx_n_s_attrs;
static PyObject *__pyx_n_s_do_deprecated;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_force;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_intify_attrs;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_lambda;
static PyObject *__pyx_n_s_lemmatize;
static PyObject *__pyx_n_s_lemmatizer;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_morphology;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_n_s_normalize_props;
static PyObject *__pyx_n_s_orth;
static PyObject *__pyx_n_s_orth_str;
static PyObject *__pyx_n_s_out;
static PyObject *__pyx_n_s_parts_of_speech;
static PyObject *__pyx_n_u_pos;
static PyObject *__pyx_n_s_props;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_sorted;
static PyObject *__pyx_n_s_spacy_morphology;
static PyObject *__pyx_n_s_string_store;
static PyObject *__pyx_n_s_tag_map;
static PyObject *__pyx_n_s_tag_str;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_univ_pos;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_u_upper;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_lambda_funcdef_5spacy_10morphology_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology__normalize_props(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_props); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology___init__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_string_store, PyObject *__pyx_v_tag_map, PyObject *__pyx_v_lemmatizer); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_2__reduce__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_4add_special_case(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_tag_str, PyObject *__pyx_v_orth_str, PyObject *__pyx_v_attrs, PyObject *__pyx_v_force); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_6load_morph_exceptions(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_8lemmatize(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __pyx_v_univ_pos, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth, PyObject *__pyx_v_morphology); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_3mem___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_7strings___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_7tag_map___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_6n_tags___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_6n_tags_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_6n_tags_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_13reverse_index___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_9tag_names___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_9tag_names_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5spacy_10morphology_10Morphology_9tag_names_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_tp_new_5spacy_10morphology_Morphology(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_codeobj__8;
/* "spacy\morphology.pyx":407
*
*
* NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])] # <<<<<<<<<<<<<<
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_2lambda(PyObject *__pyx_self, PyObject *__pyx_v_item); /*proto*/
static PyMethodDef __pyx_mdef_5spacy_10morphology_2lambda = {"lambda", (PyCFunction)__pyx_pw_5spacy_10morphology_2lambda, METH_O, 0};
static PyObject *__pyx_pw_5spacy_10morphology_2lambda(PyObject *__pyx_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lambda (wrapper)", 0);
__pyx_r = __pyx_lambda_funcdef_5spacy_10morphology_lambda(__pyx_self, ((PyObject *)__pyx_v_item));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_lambda_funcdef_5spacy_10morphology_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lambda", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("spacy.morphology.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":14
*
*
* def _normalize_props(props): # <<<<<<<<<<<<<<
* """
* Transform deprecated string keys to correct names.
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_1_normalize_props(PyObject *__pyx_self, PyObject *__pyx_v_props); /*proto*/
static char __pyx_doc_5spacy_10morphology__normalize_props[] = "\n Transform deprecated string keys to correct names.\n ";
static PyMethodDef __pyx_mdef_5spacy_10morphology_1_normalize_props = {"_normalize_props", (PyCFunction)__pyx_pw_5spacy_10morphology_1_normalize_props, METH_O, __pyx_doc_5spacy_10morphology__normalize_props};
static PyObject *__pyx_pw_5spacy_10morphology_1_normalize_props(PyObject *__pyx_self, PyObject *__pyx_v_props) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_normalize_props (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology__normalize_props(__pyx_self, ((PyObject *)__pyx_v_props));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology__normalize_props(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_props) {
PyObject *__pyx_v_out = NULL;
PyObject *__pyx_v_key = NULL;
PyObject *__pyx_v_value = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
int __pyx_t_9;
int __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_normalize_props", 0);
/* "spacy\morphology.pyx":18
* Transform deprecated string keys to correct names.
* """
* out = {} # <<<<<<<<<<<<<<
* for key, value in props.items():
* if key == POS:
*/
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_out = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":19
* """
* out = {}
* for key, value in props.items(): # <<<<<<<<<<<<<<
* if key == POS:
* if hasattr(value, 'upper'):
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_props, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
if (__pyx_t_3) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (likely(!__pyx_t_5)) {
if (likely(PyList_CheckExact(__pyx_t_2))) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
} else {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
}
} else {
__pyx_t_1 = __pyx_t_5(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_1);
}
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_6);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
__pyx_t_6 = 0;
/* "spacy\morphology.pyx":20
* out = {}
* for key, value in props.items():
* if key == POS: # <<<<<<<<<<<<<<
* if hasattr(value, 'upper'):
* value = value.upper()
*/
__pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_POS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = PyObject_RichCompare(__pyx_v_key, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_9) {
/* "spacy\morphology.pyx":21
* for key, value in props.items():
* if key == POS:
* if hasattr(value, 'upper'): # <<<<<<<<<<<<<<
* value = value.upper()
* if value in POS_IDS:
*/
__pyx_t_9 = PyObject_HasAttr(__pyx_v_value, __pyx_n_u_upper); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = (__pyx_t_9 != 0);
if (__pyx_t_10) {
/* "spacy\morphology.pyx":22
* if key == POS:
* if hasattr(value, 'upper'):
* value = value.upper() # <<<<<<<<<<<<<<
* if value in POS_IDS:
* value = POS_IDS[value]
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
}
}
if (__pyx_t_3) {
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
__pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6);
__pyx_t_6 = 0;
/* "spacy\morphology.pyx":21
* for key, value in props.items():
* if key == POS:
* if hasattr(value, 'upper'): # <<<<<<<<<<<<<<
* value = value.upper()
* if value in POS_IDS:
*/
}
/* "spacy\morphology.pyx":23
* if hasattr(value, 'upper'):
* value = value.upper()
* if value in POS_IDS: # <<<<<<<<<<<<<<
* value = POS_IDS[value]
* out[key] = value
*/
__pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_POS_IDS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_v_value, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_9 = (__pyx_t_10 != 0);
if (__pyx_t_9) {
/* "spacy\morphology.pyx":24
* value = value.upper()
* if value in POS_IDS:
* value = POS_IDS[value] # <<<<<<<<<<<<<<
* out[key] = value
* elif isinstance(key, int):
*/
__pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_POS_IDS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_value); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":23
* if hasattr(value, 'upper'):
* value = value.upper()
* if value in POS_IDS: # <<<<<<<<<<<<<<
* value = POS_IDS[value]
* out[key] = value
*/
}
/* "spacy\morphology.pyx":25
* if value in POS_IDS:
* value = POS_IDS[value]
* out[key] = value # <<<<<<<<<<<<<<
* elif isinstance(key, int):
* out[key] = value
*/
if (unlikely(PyDict_SetItem(__pyx_v_out, __pyx_v_key, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":20
* out = {}
* for key, value in props.items():
* if key == POS: # <<<<<<<<<<<<<<
* if hasattr(value, 'upper'):
* value = value.upper()
*/
goto __pyx_L7;
}
/* "spacy\morphology.pyx":26
* value = POS_IDS[value]
* out[key] = value
* elif isinstance(key, int): # <<<<<<<<<<<<<<
* out[key] = value
* elif key.lower() == 'pos':
*/
__pyx_t_9 = PyInt_Check(__pyx_v_key);
__pyx_t_10 = (__pyx_t_9 != 0);
if (__pyx_t_10) {
/* "spacy\morphology.pyx":27
* out[key] = value
* elif isinstance(key, int):
* out[key] = value # <<<<<<<<<<<<<<
* elif key.lower() == 'pos':
* out[POS] = POS_IDS[value.upper()]
*/
if (unlikely(PyDict_SetItem(__pyx_v_out, __pyx_v_key, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":26
* value = POS_IDS[value]
* out[key] = value
* elif isinstance(key, int): # <<<<<<<<<<<<<<
* out[key] = value
* elif key.lower() == 'pos':
*/
goto __pyx_L7;
}
/* "spacy\morphology.pyx":28
* elif isinstance(key, int):
* out[key] = value
* elif key.lower() == 'pos': # <<<<<<<<<<<<<<
* out[POS] = POS_IDS[value.upper()]
* else:
*/
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_lower); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_3 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_6, function);
}
}
if (__pyx_t_3) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_pos, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_10) {
/* "spacy\morphology.pyx":29
* out[key] = value
* elif key.lower() == 'pos':
* out[POS] = POS_IDS[value.upper()] # <<<<<<<<<<<<<<
* else:
* out[key] = value
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_POS_IDS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_upper); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
} else {
__pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_t_6); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyInt_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_POS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
if (unlikely(PyDict_SetItem(__pyx_v_out, __pyx_t_6, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "spacy\morphology.pyx":28
* elif isinstance(key, int):
* out[key] = value
* elif key.lower() == 'pos': # <<<<<<<<<<<<<<
* out[POS] = POS_IDS[value.upper()]
* else:
*/
goto __pyx_L7;
}
/* "spacy\morphology.pyx":31
* out[POS] = POS_IDS[value.upper()]
* else:
* out[key] = value # <<<<<<<<<<<<<<
* return out
*
*/
/*else*/ {
if (unlikely(PyDict_SetItem(__pyx_v_out, __pyx_v_key, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L7:;
/* "spacy\morphology.pyx":19
* """
* out = {}
* for key, value in props.items(): # <<<<<<<<<<<<<<
* if key == POS:
* if hasattr(value, 'upper'):
*/
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "spacy\morphology.pyx":32
* else:
* out[key] = value
* return out # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_out);
__pyx_r = __pyx_v_out;
goto __pyx_L0;
/* "spacy\morphology.pyx":14
*
*
* def _normalize_props(props): # <<<<<<<<<<<<<<
* """
* Transform deprecated string keys to correct names.
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("spacy.morphology._normalize_props", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_out);
__Pyx_XDECREF(__pyx_v_key);
__Pyx_XDECREF(__pyx_v_value);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":36
*
* cdef class Morphology:
* def __init__(self, StringStore string_store, tag_map, lemmatizer): # <<<<<<<<<<<<<<
* self.mem = Pool()
* self.strings = string_store
*/
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_string_store = 0;
PyObject *__pyx_v_tag_map = 0;
PyObject *__pyx_v_lemmatizer = 0;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_string_store,&__pyx_n_s_tag_map,&__pyx_n_s_lemmatizer,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_string_store)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_map)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lemmatizer)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_string_store = ((struct __pyx_obj_5spacy_7strings_StringStore *)values[0]);
__pyx_v_tag_map = values[1];
__pyx_v_lemmatizer = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("spacy.morphology.Morphology.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string_store), __pyx_ptype_5spacy_7strings_StringStore, 1, "string_store", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology___init__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_string_store, __pyx_v_tag_map, __pyx_v_lemmatizer);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology___init__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_string_store, PyObject *__pyx_v_tag_map, PyObject *__pyx_v_lemmatizer) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_tag_str = NULL;
PyObject *__pyx_v_attrs = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_t_6;
size_t __pyx_t_7;
void *__pyx_t_8;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *(*__pyx_t_11)(PyObject *);
int __pyx_t_12;
Py_ssize_t __pyx_t_13;
__pyx_t_5spacy_8typedefs_attr_t __pyx_t_14;
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __pyx_t_15;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
/* "spacy\morphology.pyx":37
* cdef class Morphology:
* def __init__(self, StringStore string_store, tag_map, lemmatizer):
* self.mem = Pool() # <<<<<<<<<<<<<<
* self.strings = string_store
* self.tag_map = {}
*/
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5cymem_5cymem_Pool), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->mem);
__Pyx_DECREF(((PyObject *)__pyx_v_self->mem));
__pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":38
* def __init__(self, StringStore string_store, tag_map, lemmatizer):
* self.mem = Pool()
* self.strings = string_store # <<<<<<<<<<<<<<
* self.tag_map = {}
* self.lemmatizer = lemmatizer
*/
__Pyx_INCREF(((PyObject *)__pyx_v_string_store));
__Pyx_GIVEREF(((PyObject *)__pyx_v_string_store));
__Pyx_GOTREF(__pyx_v_self->strings);
__Pyx_DECREF(((PyObject *)__pyx_v_self->strings));
__pyx_v_self->strings = __pyx_v_string_store;
/* "spacy\morphology.pyx":39
* self.mem = Pool()
* self.strings = string_store
* self.tag_map = {} # <<<<<<<<<<<<<<
* self.lemmatizer = lemmatizer
* self.n_tags = len(tag_map) + 1
*/
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->tag_map);
__Pyx_DECREF(__pyx_v_self->tag_map);
__pyx_v_self->tag_map = __pyx_t_1;
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":40
* self.strings = string_store
* self.tag_map = {}
* self.lemmatizer = lemmatizer # <<<<<<<<<<<<<<
* self.n_tags = len(tag_map) + 1
* self.tag_names = tuple(sorted(tag_map.keys()))
*/
__Pyx_INCREF(__pyx_v_lemmatizer);
__Pyx_GIVEREF(__pyx_v_lemmatizer);
__Pyx_GOTREF(__pyx_v_self->lemmatizer);
__Pyx_DECREF(__pyx_v_self->lemmatizer);
__pyx_v_self->lemmatizer = __pyx_v_lemmatizer;
/* "spacy\morphology.pyx":41
* self.tag_map = {}
* self.lemmatizer = lemmatizer
* self.n_tags = len(tag_map) + 1 # <<<<<<<<<<<<<<
* self.tag_names = tuple(sorted(tag_map.keys()))
* self.reverse_index = {}
*/
__pyx_t_2 = PyObject_Length(__pyx_v_tag_map); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = PyInt_FromSsize_t((__pyx_t_2 + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->n_tags);
__Pyx_DECREF(__pyx_v_self->n_tags);
__pyx_v_self->n_tags = __pyx_t_1;
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":42
* self.lemmatizer = lemmatizer
* self.n_tags = len(tag_map) + 1
* self.tag_names = tuple(sorted(tag_map.keys())) # <<<<<<<<<<<<<<
* self.reverse_index = {}
*
*/
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tag_map, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
if (__pyx_t_5) {
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
__pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_6 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__pyx_t_1 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_4 = PyList_AsTuple(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->tag_names);
__Pyx_DECREF(__pyx_v_self->tag_names);
__pyx_v_self->tag_names = __pyx_t_4;
__pyx_t_4 = 0;
/* "spacy\morphology.pyx":43
* self.n_tags = len(tag_map) + 1
* self.tag_names = tuple(sorted(tag_map.keys()))
* self.reverse_index = {} # <<<<<<<<<<<<<<
*
* self.rich_tags = <RichTagC*>self.mem.alloc(self.n_tags, sizeof(RichTagC))
*/
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->reverse_index);
__Pyx_DECREF(__pyx_v_self->reverse_index);
__pyx_v_self->reverse_index = __pyx_t_4;
__pyx_t_4 = 0;
/* "spacy\morphology.pyx":45
* self.reverse_index = {}
*
* self.rich_tags = <RichTagC*>self.mem.alloc(self.n_tags, sizeof(RichTagC)) # <<<<<<<<<<<<<<
* for i, (tag_str, attrs) in enumerate(sorted(tag_map.items())):
* attrs = _normalize_props(attrs)
*/
__pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_v_self->n_tags); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, __pyx_t_7, (sizeof(struct __pyx_t_5spacy_10morphology_RichTagC))); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->rich_tags = ((struct __pyx_t_5spacy_10morphology_RichTagC *)__pyx_t_8);
/* "spacy\morphology.pyx":46
*
* self.rich_tags = <RichTagC*>self.mem.alloc(self.n_tags, sizeof(RichTagC))
* for i, (tag_str, attrs) in enumerate(sorted(tag_map.items())): # <<<<<<<<<<<<<<
* attrs = _normalize_props(attrs)
* self.tag_map[tag_str] = dict(attrs)
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_4 = __pyx_int_0;
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tag_map, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_9)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
}
}
if (__pyx_t_9) {
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
} else {
__pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_6 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_9 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_9);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_11 = NULL;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_11 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_tag_str, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_XDECREF_SET(__pyx_v_attrs, __pyx_t_9);
__pyx_t_9 = 0;
__Pyx_INCREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4);
__pyx_t_4 = __pyx_t_1;
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":47
* self.rich_tags = <RichTagC*>self.mem.alloc(self.n_tags, sizeof(RichTagC))
* for i, (tag_str, attrs) in enumerate(sorted(tag_map.items())):
* attrs = _normalize_props(attrs) # <<<<<<<<<<<<<<
* self.tag_map[tag_str] = dict(attrs)
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
*/
__pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_normalize_props); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_3 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_9, function);
}
}
if (!__pyx_t_3) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_attrs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
} else {
__pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_v_attrs);
__Pyx_GIVEREF(__pyx_v_attrs);
PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_attrs);
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":48
* for i, (tag_str, attrs) in enumerate(sorted(tag_map.items())):
* attrs = _normalize_props(attrs)
* self.tag_map[tag_str] = dict(attrs) # <<<<<<<<<<<<<<
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* self.rich_tags[i].id = i
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_attrs);
__Pyx_GIVEREF(__pyx_v_attrs);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_attrs);
__pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&PyDict_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(PyObject_SetItem(__pyx_v_self->tag_map, __pyx_v_tag_str, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
/* "spacy\morphology.pyx":49
* attrs = _normalize_props(attrs)
* self.tag_map[tag_str] = dict(attrs)
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True) # <<<<<<<<<<<<<<
* self.rich_tags[i].id = i
* self.rich_tags[i].name = self.strings[tag_str]
*/
__pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_intify_attrs); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_attrs);
__Pyx_GIVEREF(__pyx_v_attrs);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_attrs);
__Pyx_INCREF(((PyObject *)__pyx_v_self->strings));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->strings));
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->strings));
__pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_do_deprecated, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_3);
__pyx_t_3 = 0;
/* "spacy\morphology.pyx":50
* self.tag_map[tag_str] = dict(attrs)
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* self.rich_tags[i].id = i # <<<<<<<<<<<<<<
* self.rich_tags[i].name = self.strings[tag_str]
* self.rich_tags[i].morph = 0
*/
__pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->rich_tags[__pyx_t_13]).id = __pyx_t_12;
/* "spacy\morphology.pyx":51
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* self.rich_tags[i].id = i
* self.rich_tags[i].name = self.strings[tag_str] # <<<<<<<<<<<<<<
* self.rich_tags[i].morph = 0
* self.rich_tags[i].pos = attrs[POS]
*/
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_tag_str); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_14 = __Pyx_PyInt_As_int32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->rich_tags[__pyx_t_13]).name = __pyx_t_14;
/* "spacy\morphology.pyx":52
* self.rich_tags[i].id = i
* self.rich_tags[i].name = self.strings[tag_str]
* self.rich_tags[i].morph = 0 # <<<<<<<<<<<<<<
* self.rich_tags[i].pos = attrs[POS]
* self.reverse_index[self.rich_tags[i].name] = i
*/
__pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->rich_tags[__pyx_t_13]).morph = 0;
/* "spacy\morphology.pyx":53
* self.rich_tags[i].name = self.strings[tag_str]
* self.rich_tags[i].morph = 0
* self.rich_tags[i].pos = attrs[POS] # <<<<<<<<<<<<<<
* self.reverse_index[self.rich_tags[i].name] = i
* self._cache = PreshMapArray(self.n_tags)
*/
__pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_POS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_10 = PyObject_GetItem(__pyx_v_attrs, __pyx_t_3); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_15 = ((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)__Pyx_PyInt_As_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_t_10)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->rich_tags[__pyx_t_13]).pos = __pyx_t_15;
/* "spacy\morphology.pyx":54
* self.rich_tags[i].morph = 0
* self.rich_tags[i].pos = attrs[POS]
* self.reverse_index[self.rich_tags[i].name] = i # <<<<<<<<<<<<<<
* self._cache = PreshMapArray(self.n_tags)
*
*/
__pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__Pyx_SetItemInt(__pyx_v_self->reverse_index, (__pyx_v_self->rich_tags[__pyx_t_13]).name, __pyx_v_i, __pyx_t_5spacy_8typedefs_attr_t, 1, __Pyx_PyInt_From_int32_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":46
*
* self.rich_tags = <RichTagC*>self.mem.alloc(self.n_tags, sizeof(RichTagC))
* for i, (tag_str, attrs) in enumerate(sorted(tag_map.items())): # <<<<<<<<<<<<<<
* attrs = _normalize_props(attrs)
* self.tag_map[tag_str] = dict(attrs)
*/
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "spacy\morphology.pyx":55
* self.rich_tags[i].pos = attrs[POS]
* self.reverse_index[self.rich_tags[i].name] = i
* self._cache = PreshMapArray(self.n_tags) # <<<<<<<<<<<<<<
*
* def __reduce__(self):
*/
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_self->n_tags);
__Pyx_GIVEREF(__pyx_v_self->n_tags);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->n_tags);
__pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7preshed_4maps_PreshMapArray), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_v_self->_cache);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_cache));
__pyx_v_self->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMapArray *)__pyx_t_5);
__pyx_t_5 = 0;
/* "spacy\morphology.pyx":36
*
* cdef class Morphology:
* def __init__(self, StringStore string_store, tag_map, lemmatizer): # <<<<<<<<<<<<<<
* self.mem = Pool()
* self.strings = string_store
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("spacy.morphology.Morphology.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_tag_str);
__Pyx_XDECREF(__pyx_v_attrs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":57
* self._cache = PreshMapArray(self.n_tags)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
* return (Morphology, (self.strings, self.tag_map, self.lemmatizer), None, None)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_2__reduce__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_2__reduce__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__reduce__", 0);
/* "spacy\morphology.pyx":58
*
* def __reduce__(self):
* return (Morphology, (self.strings, self.tag_map, self.lemmatizer), None, None) # <<<<<<<<<<<<<<
*
* cdef int assign_tag(self, TokenC* token, tag) except -1:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_self->strings));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->strings));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->strings));
__Pyx_INCREF(__pyx_v_self->tag_map);
__Pyx_GIVEREF(__pyx_v_self->tag_map);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->tag_map);
__Pyx_INCREF(__pyx_v_self->lemmatizer);
__Pyx_GIVEREF(__pyx_v_self->lemmatizer);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->lemmatizer);
__pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_ptype_5spacy_10morphology_Morphology));
__Pyx_GIVEREF(((PyObject *)__pyx_ptype_5spacy_10morphology_Morphology));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_5spacy_10morphology_Morphology));
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_2, 3, Py_None);
__pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* "spacy\morphology.pyx":57
* self._cache = PreshMapArray(self.n_tags)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
* return (Morphology, (self.strings, self.tag_map, self.lemmatizer), None, None)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("spacy.morphology.Morphology.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":60
* return (Morphology, (self.strings, self.tag_map, self.lemmatizer), None, None)
*
* cdef int assign_tag(self, TokenC* token, tag) except -1: # <<<<<<<<<<<<<<
* if isinstance(tag, basestring):
* tag_id = self.reverse_index[self.strings[tag]]
*/
static int __pyx_f_5spacy_10morphology_10Morphology_assign_tag(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, PyObject *__pyx_v_tag) {
PyObject *__pyx_v_tag_id = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assign_tag", 0);
/* "spacy\morphology.pyx":61
*
* cdef int assign_tag(self, TokenC* token, tag) except -1:
* if isinstance(tag, basestring): # <<<<<<<<<<<<<<
* tag_id = self.reverse_index[self.strings[tag]]
* else:
*/
__pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_tag);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* "spacy\morphology.pyx":62
* cdef int assign_tag(self, TokenC* token, tag) except -1:
* if isinstance(tag, basestring):
* tag_id = self.reverse_index[self.strings[tag]] # <<<<<<<<<<<<<<
* else:
* tag_id = self.reverse_index[tag]
*/
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_tag); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_GetItem(__pyx_v_self->reverse_index, __pyx_t_3); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_tag_id = __pyx_t_4;
__pyx_t_4 = 0;
/* "spacy\morphology.pyx":61
*
* cdef int assign_tag(self, TokenC* token, tag) except -1:
* if isinstance(tag, basestring): # <<<<<<<<<<<<<<
* tag_id = self.reverse_index[self.strings[tag]]
* else:
*/
goto __pyx_L3;
}
/* "spacy\morphology.pyx":64
* tag_id = self.reverse_index[self.strings[tag]]
* else:
* tag_id = self.reverse_index[tag] # <<<<<<<<<<<<<<
* self.assign_tag_id(token, tag_id)
*
*/
/*else*/ {
__pyx_t_4 = PyObject_GetItem(__pyx_v_self->reverse_index, __pyx_v_tag); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_tag_id = __pyx_t_4;
__pyx_t_4 = 0;
}
__pyx_L3:;
/* "spacy\morphology.pyx":65
* else:
* tag_id = self.reverse_index[tag]
* self.assign_tag_id(token, tag_id) # <<<<<<<<<<<<<<
*
* cdef int assign_tag_id(self, TokenC* token, int tag_id) except -1:
*/
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_tag_id); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_10morphology_Morphology *)__pyx_v_self->__pyx_vtab)->assign_tag_id(__pyx_v_self, __pyx_v_token, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":60
* return (Morphology, (self.strings, self.tag_map, self.lemmatizer), None, None)
*
* cdef int assign_tag(self, TokenC* token, tag) except -1: # <<<<<<<<<<<<<<
* if isinstance(tag, basestring):
* tag_id = self.reverse_index[self.strings[tag]]
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("spacy.morphology.Morphology.assign_tag", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tag_id);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":67
* self.assign_tag_id(token, tag_id)
*
* cdef int assign_tag_id(self, TokenC* token, int tag_id) except -1: # <<<<<<<<<<<<<<
* if tag_id >= self.n_tags:
* raise ValueError("Unknown tag ID: %s" % tag_id)
*/
static int __pyx_f_5spacy_10morphology_10Morphology_assign_tag_id(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, int __pyx_v_tag_id) {
struct __pyx_t_5spacy_10morphology_RichTagC __pyx_v_rich_tag;
struct __pyx_t_5spacy_10morphology_MorphAnalysisC *__pyx_v_analysis;
PyObject *__pyx_v_tag_str = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
void *__pyx_t_5;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
Py_ssize_t __pyx_t_12;
PyObject *__pyx_t_13 = NULL;
__pyx_t_5spacy_8typedefs_attr_t __pyx_t_14;
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __pyx_t_15;
uint64_t __pyx_t_16;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assign_tag_id", 0);
/* "spacy\morphology.pyx":68
*
* cdef int assign_tag_id(self, TokenC* token, int tag_id) except -1:
* if tag_id >= self.n_tags: # <<<<<<<<<<<<<<
* raise ValueError("Unknown tag ID: %s" % tag_id)
* # TODO: It's pretty arbitrary to put this logic here. I guess the justification
*/
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_tag_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_self->n_tags, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
/* "spacy\morphology.pyx":69
* cdef int assign_tag_id(self, TokenC* token, int tag_id) except -1:
* if tag_id >= self.n_tags:
* raise ValueError("Unknown tag ID: %s" % tag_id) # <<<<<<<<<<<<<<
* # TODO: It's pretty arbitrary to put this logic here. I guess the justification
* # is that this is where the specific word and the tag interact. Still,
*/
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_tag_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Unknown_tag_ID_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":68
*
* cdef int assign_tag_id(self, TokenC* token, int tag_id) except -1:
* if tag_id >= self.n_tags: # <<<<<<<<<<<<<<
* raise ValueError("Unknown tag ID: %s" % tag_id)
* # TODO: It's pretty arbitrary to put this logic here. I guess the justification
*/
}
/* "spacy\morphology.pyx":75
* # the statistical model fails.
* # Related to Issue #220
* if Lexeme.c_check_flag(token.lex, IS_SPACE): # <<<<<<<<<<<<<<
* tag_id = self.reverse_index[self.strings['SP']]
* rich_tag = self.rich_tags[tag_id]
*/
__pyx_t_3 = (__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE) != 0);
if (__pyx_t_3) {
/* "spacy\morphology.pyx":76
* # Related to Issue #220
* if Lexeme.c_check_flag(token.lex, IS_SPACE):
* tag_id = self.reverse_index[self.strings['SP']] # <<<<<<<<<<<<<<
* rich_tag = self.rich_tags[tag_id]
* analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth)
*/
__pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_n_u_SP); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetItem(__pyx_v_self->reverse_index, __pyx_t_1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_tag_id = __pyx_t_4;
/* "spacy\morphology.pyx":75
* # the statistical model fails.
* # Related to Issue #220
* if Lexeme.c_check_flag(token.lex, IS_SPACE): # <<<<<<<<<<<<<<
* tag_id = self.reverse_index[self.strings['SP']]
* rich_tag = self.rich_tags[tag_id]
*/
}
/* "spacy\morphology.pyx":77
* if Lexeme.c_check_flag(token.lex, IS_SPACE):
* tag_id = self.reverse_index[self.strings['SP']]
* rich_tag = self.rich_tags[tag_id] # <<<<<<<<<<<<<<
* analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth)
* if analysis is NULL:
*/
__pyx_v_rich_tag = (__pyx_v_self->rich_tags[__pyx_v_tag_id]);
/* "spacy\morphology.pyx":78
* tag_id = self.reverse_index[self.strings['SP']]
* rich_tag = self.rich_tags[tag_id]
* analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth) # <<<<<<<<<<<<<<
* if analysis is NULL:
* analysis = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
*/
__pyx_v_analysis = ((struct __pyx_t_5spacy_10morphology_MorphAnalysisC *)((struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *)__pyx_v_self->_cache->__pyx_vtab)->get(__pyx_v_self->_cache, __pyx_v_tag_id, __pyx_v_token->lex->orth));
/* "spacy\morphology.pyx":79
* rich_tag = self.rich_tags[tag_id]
* analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth)
* if analysis is NULL: # <<<<<<<<<<<<<<
* analysis = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* tag_str = self.strings[self.rich_tags[tag_id].name]
*/
__pyx_t_3 = ((__pyx_v_analysis == NULL) != 0);
if (__pyx_t_3) {
/* "spacy\morphology.pyx":80
* analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth)
* if analysis is NULL:
* analysis = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC)) # <<<<<<<<<<<<<<
* tag_str = self.strings[self.rich_tags[tag_id].name]
* analysis.tag = rich_tag
*/
__pyx_t_5 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, 1, (sizeof(struct __pyx_t_5spacy_10morphology_MorphAnalysisC))); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_analysis = ((struct __pyx_t_5spacy_10morphology_MorphAnalysisC *)__pyx_t_5);
/* "spacy\morphology.pyx":81
* if analysis is NULL:
* analysis = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* tag_str = self.strings[self.rich_tags[tag_id].name] # <<<<<<<<<<<<<<
* analysis.tag = rich_tag
* analysis.lemma = self.lemmatize(analysis.tag.pos, token.lex.orth,
*/
__pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), (__pyx_v_self->rich_tags[__pyx_v_tag_id]).name, __pyx_t_5spacy_8typedefs_attr_t, 1, __Pyx_PyInt_From_int32_t, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_tag_str = __pyx_t_2;
__pyx_t_2 = 0;
/* "spacy\morphology.pyx":82
* analysis = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* tag_str = self.strings[self.rich_tags[tag_id].name]
* analysis.tag = rich_tag # <<<<<<<<<<<<<<
* analysis.lemma = self.lemmatize(analysis.tag.pos, token.lex.orth,
* self.tag_map.get(tag_str, {}))
*/
__pyx_v_analysis->tag = __pyx_v_rich_tag;
/* "spacy\morphology.pyx":83
* tag_str = self.strings[self.rich_tags[tag_id].name]
* analysis.tag = rich_tag
* analysis.lemma = self.lemmatize(analysis.tag.pos, token.lex.orth, # <<<<<<<<<<<<<<
* self.tag_map.get(tag_str, {}))
* self._cache.set(tag_id, token.lex.orth, analysis)
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lemmatize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = __Pyx_PyInt_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_v_analysis->tag.pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyInt_From_int32_t(__pyx_v_token->lex->orth); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
/* "spacy\morphology.pyx":84
* analysis.tag = rich_tag
* analysis.lemma = self.lemmatize(analysis.tag.pos, token.lex.orth,
* self.tag_map.get(tag_str, {})) # <<<<<<<<<<<<<<
* self._cache.set(tag_id, token.lex.orth, analysis)
* token.lemma = analysis.lemma
*/
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->tag_map, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_11 = NULL;
__pyx_t_12 = 0;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
__pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
if (likely(__pyx_t_11)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
__Pyx_INCREF(__pyx_t_11);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_9, function);
__pyx_t_12 = 1;
}
}
__pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
if (__pyx_t_11) {
__Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
}
__Pyx_INCREF(__pyx_v_tag_str);
__Pyx_GIVEREF(__pyx_v_tag_str);
PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_tag_str);
__Pyx_GIVEREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = NULL;
__pyx_t_12 = 0;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_9)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
__pyx_t_12 = 1;
}
}
__pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
if (__pyx_t_9) {
__Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); __pyx_t_9 = NULL;
}
__Pyx_GIVEREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_8);
__pyx_t_6 = 0;
__pyx_t_7 = 0;
__pyx_t_8 = 0;
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "spacy\morphology.pyx":83
* tag_str = self.strings[self.rich_tags[tag_id].name]
* analysis.tag = rich_tag
* analysis.lemma = self.lemmatize(analysis.tag.pos, token.lex.orth, # <<<<<<<<<<<<<<
* self.tag_map.get(tag_str, {}))
* self._cache.set(tag_id, token.lex.orth, analysis)
*/
__pyx_t_14 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_analysis->lemma = __pyx_t_14;
/* "spacy\morphology.pyx":85
* analysis.lemma = self.lemmatize(analysis.tag.pos, token.lex.orth,
* self.tag_map.get(tag_str, {}))
* self._cache.set(tag_id, token.lex.orth, analysis) # <<<<<<<<<<<<<<
* token.lemma = analysis.lemma
* token.pos = analysis.tag.pos
*/
((struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *)__pyx_v_self->_cache->__pyx_vtab)->set(__pyx_v_self->_cache, __pyx_v_tag_id, __pyx_v_token->lex->orth, __pyx_v_analysis); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":79
* rich_tag = self.rich_tags[tag_id]
* analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth)
* if analysis is NULL: # <<<<<<<<<<<<<<
* analysis = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* tag_str = self.strings[self.rich_tags[tag_id].name]
*/
}
/* "spacy\morphology.pyx":86
* self.tag_map.get(tag_str, {}))
* self._cache.set(tag_id, token.lex.orth, analysis)
* token.lemma = analysis.lemma # <<<<<<<<<<<<<<
* token.pos = analysis.tag.pos
* token.tag = analysis.tag.name
*/
__pyx_t_14 = __pyx_v_analysis->lemma;
__pyx_v_token->lemma = __pyx_t_14;
/* "spacy\morphology.pyx":87
* self._cache.set(tag_id, token.lex.orth, analysis)
* token.lemma = analysis.lemma
* token.pos = analysis.tag.pos # <<<<<<<<<<<<<<
* token.tag = analysis.tag.name
* token.morph = analysis.tag.morph
*/
__pyx_t_15 = __pyx_v_analysis->tag.pos;
__pyx_v_token->pos = __pyx_t_15;
/* "spacy\morphology.pyx":88
* token.lemma = analysis.lemma
* token.pos = analysis.tag.pos
* token.tag = analysis.tag.name # <<<<<<<<<<<<<<
* token.morph = analysis.tag.morph
*
*/
__pyx_t_14 = __pyx_v_analysis->tag.name;
__pyx_v_token->tag = __pyx_t_14;
/* "spacy\morphology.pyx":89
* token.pos = analysis.tag.pos
* token.tag = analysis.tag.name
* token.morph = analysis.tag.morph # <<<<<<<<<<<<<<
*
* cdef int assign_feature(self, uint64_t* flags, univ_morph_t flag_id, bint value) except -1:
*/
__pyx_t_16 = __pyx_v_analysis->tag.morph;
__pyx_v_token->morph = __pyx_t_16;
/* "spacy\morphology.pyx":67
* self.assign_tag_id(token, tag_id)
*
* cdef int assign_tag_id(self, TokenC* token, int tag_id) except -1: # <<<<<<<<<<<<<<
* if tag_id >= self.n_tags:
* raise ValueError("Unknown tag ID: %s" % tag_id)
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("spacy.morphology.Morphology.assign_tag_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tag_str);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":91
* token.morph = analysis.tag.morph
*
* cdef int assign_feature(self, uint64_t* flags, univ_morph_t flag_id, bint value) except -1: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if value:
*/
static int __pyx_f_5spacy_10morphology_10Morphology_assign_feature(CYTHON_UNUSED struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, uint64_t *__pyx_v_flags, enum __pyx_t_5spacy_10morphology_univ_morph_t __pyx_v_flag_id, int __pyx_v_value) {
__pyx_t_5spacy_8typedefs_flags_t __pyx_v_one;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
long __pyx_t_2;
__Pyx_RefNannySetupContext("assign_feature", 0);
/* "spacy\morphology.pyx":92
*
* cdef int assign_feature(self, uint64_t* flags, univ_morph_t flag_id, bint value) except -1:
* cdef flags_t one = 1 # <<<<<<<<<<<<<<
* if value:
* flags[0] |= one << flag_id
*/
__pyx_v_one = 1;
/* "spacy\morphology.pyx":93
* cdef int assign_feature(self, uint64_t* flags, univ_morph_t flag_id, bint value) except -1:
* cdef flags_t one = 1
* if value: # <<<<<<<<<<<<<<
* flags[0] |= one << flag_id
* else:
*/
__pyx_t_1 = (__pyx_v_value != 0);
if (__pyx_t_1) {
/* "spacy\morphology.pyx":94
* cdef flags_t one = 1
* if value:
* flags[0] |= one << flag_id # <<<<<<<<<<<<<<
* else:
* flags[0] &= ~(one << flag_id)
*/
__pyx_t_2 = 0;
(__pyx_v_flags[__pyx_t_2]) = ((__pyx_v_flags[__pyx_t_2]) | (__pyx_v_one << __pyx_v_flag_id));
/* "spacy\morphology.pyx":93
* cdef int assign_feature(self, uint64_t* flags, univ_morph_t flag_id, bint value) except -1:
* cdef flags_t one = 1
* if value: # <<<<<<<<<<<<<<
* flags[0] |= one << flag_id
* else:
*/
goto __pyx_L3;
}
/* "spacy\morphology.pyx":96
* flags[0] |= one << flag_id
* else:
* flags[0] &= ~(one << flag_id) # <<<<<<<<<<<<<<
*
* def add_special_case(self, unicode tag_str, unicode orth_str, attrs, force=False):
*/
/*else*/ {
__pyx_t_2 = 0;
(__pyx_v_flags[__pyx_t_2]) = ((__pyx_v_flags[__pyx_t_2]) & (~(__pyx_v_one << __pyx_v_flag_id)));
}
__pyx_L3:;
/* "spacy\morphology.pyx":91
* token.morph = analysis.tag.morph
*
* cdef int assign_feature(self, uint64_t* flags, univ_morph_t flag_id, bint value) except -1: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if value:
*/
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":98
* flags[0] &= ~(one << flag_id)
*
* def add_special_case(self, unicode tag_str, unicode orth_str, attrs, force=False): # <<<<<<<<<<<<<<
* """
* Add a special-case rule to the morphological analyser. Tokens whose
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_5add_special_case(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5spacy_10morphology_10Morphology_4add_special_case[] = "\n Add a special-case rule to the morphological analyser. Tokens whose\n tag and orth match the rule will receive the specified properties.\n\n Arguments:\n tag (unicode): The part-of-speech tag to key the exception.\n orth (unicode): The word-form to key the exception.\n ";
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_5add_special_case(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_tag_str = 0;
PyObject *__pyx_v_orth_str = 0;
PyObject *__pyx_v_attrs = 0;
PyObject *__pyx_v_force = 0;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_special_case (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_str,&__pyx_n_s_orth_str,&__pyx_n_s_attrs,&__pyx_n_s_force,0};
PyObject* values[4] = {0,0,0,0};
values[3] = ((PyObject *)Py_False);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_str)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_orth_str)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("add_special_case", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrs)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("add_special_case", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_force);
if (value) { values[3] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_special_case") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_tag_str = ((PyObject*)values[0]);
__pyx_v_orth_str = ((PyObject*)values[1]);
__pyx_v_attrs = values[2];
__pyx_v_force = values[3];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("add_special_case", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("spacy.morphology.Morphology.add_special_case", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tag_str), (&PyUnicode_Type), 1, "tag_str", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_orth_str), (&PyUnicode_Type), 1, "orth_str", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_4add_special_case(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_tag_str, __pyx_v_orth_str, __pyx_v_attrs, __pyx_v_force);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_4add_special_case(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_tag_str, PyObject *__pyx_v_orth_str, PyObject *__pyx_v_attrs, PyObject *__pyx_v_force) {
PyObject *__pyx_v_tag = NULL;
PyObject *__pyx_v_tag_id = NULL;
PyObject *__pyx_v_orth = NULL;
struct __pyx_t_5spacy_10morphology_RichTagC __pyx_v_rich_tag;
struct __pyx_t_5spacy_10morphology_MorphAnalysisC *__pyx_v_cached;
PyObject *__pyx_v_msg = NULL;
PyObject *__pyx_v_name_id = NULL;
PyObject *__pyx_v_value_id = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
size_t __pyx_t_6;
__pyx_t_7preshed_4maps_key_t __pyx_t_7;
int __pyx_t_8;
void *__pyx_t_9;
PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
PyObject *(*__pyx_t_12)(PyObject *);
__pyx_t_5spacy_8typedefs_attr_t __pyx_t_13;
enum __pyx_t_5spacy_10morphology_univ_morph_t __pyx_t_14;
int __pyx_t_15;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("add_special_case", 0);
__Pyx_INCREF(__pyx_v_attrs);
/* "spacy\morphology.pyx":107
* orth (unicode): The word-form to key the exception.
* """
* tag = self.strings[tag_str] # <<<<<<<<<<<<<<
* tag_id = self.reverse_index[tag]
* orth = self.strings[orth_str]
*/
__pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_tag_str); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_tag = __pyx_t_1;
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":108
* """
* tag = self.strings[tag_str]
* tag_id = self.reverse_index[tag] # <<<<<<<<<<<<<<
* orth = self.strings[orth_str]
* cdef RichTagC rich_tag = self.rich_tags[tag_id]
*/
__pyx_t_1 = PyObject_GetItem(__pyx_v_self->reverse_index, __pyx_v_tag); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_tag_id = __pyx_t_1;
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":109
* tag = self.strings[tag_str]
* tag_id = self.reverse_index[tag]
* orth = self.strings[orth_str] # <<<<<<<<<<<<<<
* cdef RichTagC rich_tag = self.rich_tags[tag_id]
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
*/
__pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_orth_str); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_orth = __pyx_t_1;
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":110
* tag_id = self.reverse_index[tag]
* orth = self.strings[orth_str]
* cdef RichTagC rich_tag = self.rich_tags[tag_id] # <<<<<<<<<<<<<<
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* cached = <MorphAnalysisC*>self._cache.get(tag_id, orth)
*/
__pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_tag_id); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_rich_tag = (__pyx_v_self->rich_tags[__pyx_t_2]);
/* "spacy\morphology.pyx":111
* orth = self.strings[orth_str]
* cdef RichTagC rich_tag = self.rich_tags[tag_id]
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True) # <<<<<<<<<<<<<<
* cached = <MorphAnalysisC*>self._cache.get(tag_id, orth)
* if cached is NULL:
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_intify_attrs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_attrs);
__Pyx_GIVEREF(__pyx_v_attrs);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_attrs);
__Pyx_INCREF(((PyObject *)__pyx_v_self->strings));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->strings));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->strings));
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_do_deprecated, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_5);
__pyx_t_5 = 0;
/* "spacy\morphology.pyx":112
* cdef RichTagC rich_tag = self.rich_tags[tag_id]
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* cached = <MorphAnalysisC*>self._cache.get(tag_id, orth) # <<<<<<<<<<<<<<
* if cached is NULL:
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
*/
__pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_tag_id); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_v_orth); if (unlikely((__pyx_t_7 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_cached = ((struct __pyx_t_5spacy_10morphology_MorphAnalysisC *)((struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *)__pyx_v_self->_cache->__pyx_vtab)->get(__pyx_v_self->_cache, __pyx_t_6, __pyx_t_7));
/* "spacy\morphology.pyx":113
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* cached = <MorphAnalysisC*>self._cache.get(tag_id, orth)
* if cached is NULL: # <<<<<<<<<<<<<<
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* elif force:
*/
__pyx_t_8 = ((__pyx_v_cached == NULL) != 0);
if (__pyx_t_8) {
/* "spacy\morphology.pyx":114
* cached = <MorphAnalysisC*>self._cache.get(tag_id, orth)
* if cached is NULL:
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC)) # <<<<<<<<<<<<<<
* elif force:
* memset(cached, 0, sizeof(cached[0]))
*/
__pyx_t_9 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, 1, (sizeof(struct __pyx_t_5spacy_10morphology_MorphAnalysisC))); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_cached = ((struct __pyx_t_5spacy_10morphology_MorphAnalysisC *)__pyx_t_9);
/* "spacy\morphology.pyx":113
* attrs = intify_attrs(attrs, self.strings, _do_deprecated=True)
* cached = <MorphAnalysisC*>self._cache.get(tag_id, orth)
* if cached is NULL: # <<<<<<<<<<<<<<
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* elif force:
*/
goto __pyx_L3;
}
/* "spacy\morphology.pyx":115
* if cached is NULL:
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* elif force: # <<<<<<<<<<<<<<
* memset(cached, 0, sizeof(cached[0]))
* else:
*/
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_8) {
/* "spacy\morphology.pyx":116
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* elif force:
* memset(cached, 0, sizeof(cached[0])) # <<<<<<<<<<<<<<
* else:
* msg = ("Conflicting morphology exception for (%s, %s). Use force=True "
*/
memset(__pyx_v_cached, 0, (sizeof((__pyx_v_cached[0]))));
/* "spacy\morphology.pyx":115
* if cached is NULL:
* cached = <MorphAnalysisC*>self.mem.alloc(1, sizeof(MorphAnalysisC))
* elif force: # <<<<<<<<<<<<<<
* memset(cached, 0, sizeof(cached[0]))
* else:
*/
goto __pyx_L3;
}
/* "spacy\morphology.pyx":118
* memset(cached, 0, sizeof(cached[0]))
* else:
* msg = ("Conflicting morphology exception for (%s, %s). Use force=True " # <<<<<<<<<<<<<<
* "to overwrite.")
* msg = msg % (tag_str, orth_str)
*/
/*else*/ {
__Pyx_INCREF(__pyx_kp_u_Conflicting_morphology_exception);
__pyx_v_msg = __pyx_kp_u_Conflicting_morphology_exception;
/* "spacy\morphology.pyx":120
* msg = ("Conflicting morphology exception for (%s, %s). Use force=True "
* "to overwrite.")
* msg = msg % (tag_str, orth_str) # <<<<<<<<<<<<<<
* raise ValueError(msg)
*
*/
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_tag_str);
__Pyx_GIVEREF(__pyx_v_tag_str);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_tag_str);
__Pyx_INCREF(__pyx_v_orth_str);
__Pyx_GIVEREF(__pyx_v_orth_str);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_orth_str);
__pyx_t_4 = PyUnicode_Format(__pyx_v_msg, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
/* "spacy\morphology.pyx":121
* "to overwrite.")
* msg = msg % (tag_str, orth_str)
* raise ValueError(msg) # <<<<<<<<<<<<<<
*
* cached.tag = rich_tag
*/
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_msg);
__Pyx_GIVEREF(__pyx_v_msg);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msg);
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
/* "spacy\morphology.pyx":123
* raise ValueError(msg)
*
* cached.tag = rich_tag # <<<<<<<<<<<<<<
* # TODO: Refactor this to take arbitrary attributes.
* for name_id, value_id in attrs.items():
*/
__pyx_v_cached->tag = __pyx_v_rich_tag;
/* "spacy\morphology.pyx":125
* cached.tag = rich_tag
* # TODO: Refactor this to take arbitrary attributes.
* for name_id, value_id in attrs.items(): # <<<<<<<<<<<<<<
* if name_id == LEMMA:
* cached.lemma = value_id
*/
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrs, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
if (__pyx_t_3) {
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
__pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
__pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
__pyx_t_10 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
for (;;) {
if (likely(!__pyx_t_10)) {
if (likely(PyList_CheckExact(__pyx_t_4))) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
#endif
} else {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
#endif
}
} else {
__pyx_t_5 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_5)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_5);
}
if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
PyObject* sequence = __pyx_t_5;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_1 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_1);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_name_id, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_XDECREF_SET(__pyx_v_value_id, __pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":126
* # TODO: Refactor this to take arbitrary attributes.
* for name_id, value_id in attrs.items():
* if name_id == LEMMA: # <<<<<<<<<<<<<<
* cached.lemma = value_id
* else:
*/
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_LEMMA); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = PyObject_RichCompare(__pyx_v_name_id, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_8) {
/* "spacy\morphology.pyx":127
* for name_id, value_id in attrs.items():
* if name_id == LEMMA:
* cached.lemma = value_id # <<<<<<<<<<<<<<
* else:
* self.assign_feature(&cached.tag.morph, name_id, value_id)
*/
__pyx_t_13 = __Pyx_PyInt_As_int32_t(__pyx_v_value_id); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_cached->lemma = __pyx_t_13;
/* "spacy\morphology.pyx":126
* # TODO: Refactor this to take arbitrary attributes.
* for name_id, value_id in attrs.items():
* if name_id == LEMMA: # <<<<<<<<<<<<<<
* cached.lemma = value_id
* else:
*/
goto __pyx_L8;
}
/* "spacy\morphology.pyx":129
* cached.lemma = value_id
* else:
* self.assign_feature(&cached.tag.morph, name_id, value_id) # <<<<<<<<<<<<<<
* if cached.lemma == 0:
* cached.lemma = self.lemmatize(rich_tag.pos, orth, attrs)
*/
/*else*/ {
__pyx_t_14 = ((enum __pyx_t_5spacy_10morphology_univ_morph_t)__Pyx_PyInt_As_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_v_name_id)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_value_id); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_15 = ((struct __pyx_vtabstruct_5spacy_10morphology_Morphology *)__pyx_v_self->__pyx_vtab)->assign_feature(__pyx_v_self, (&__pyx_v_cached->tag.morph), __pyx_t_14, __pyx_t_8); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L8:;
/* "spacy\morphology.pyx":125
* cached.tag = rich_tag
* # TODO: Refactor this to take arbitrary attributes.
* for name_id, value_id in attrs.items(): # <<<<<<<<<<<<<<
* if name_id == LEMMA:
* cached.lemma = value_id
*/
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "spacy\morphology.pyx":130
* else:
* self.assign_feature(&cached.tag.morph, name_id, value_id)
* if cached.lemma == 0: # <<<<<<<<<<<<<<
* cached.lemma = self.lemmatize(rich_tag.pos, orth, attrs)
* self._cache.set(tag_id, orth, <void*>cached)
*/
__pyx_t_8 = ((__pyx_v_cached->lemma == 0) != 0);
if (__pyx_t_8) {
/* "spacy\morphology.pyx":131
* self.assign_feature(&cached.tag.morph, name_id, value_id)
* if cached.lemma == 0:
* cached.lemma = self.lemmatize(rich_tag.pos, orth, attrs) # <<<<<<<<<<<<<<
* self._cache.set(tag_id, orth, <void*>cached)
*
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lemmatize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_v_rich_tag.pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = NULL;
__pyx_t_2 = 0;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
__pyx_t_2 = 1;
}
}
__pyx_t_11 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
if (__pyx_t_3) {
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL;
}
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_2, __pyx_t_5);
__Pyx_INCREF(__pyx_v_orth);
__Pyx_GIVEREF(__pyx_v_orth);
PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_2, __pyx_v_orth);
__Pyx_INCREF(__pyx_v_attrs);
__Pyx_GIVEREF(__pyx_v_attrs);
PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_2, __pyx_v_attrs);
__pyx_t_5 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_13 = __Pyx_PyInt_As_int32_t(__pyx_t_4); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_cached->lemma = __pyx_t_13;
/* "spacy\morphology.pyx":130
* else:
* self.assign_feature(&cached.tag.morph, name_id, value_id)
* if cached.lemma == 0: # <<<<<<<<<<<<<<
* cached.lemma = self.lemmatize(rich_tag.pos, orth, attrs)
* self._cache.set(tag_id, orth, <void*>cached)
*/
}
/* "spacy\morphology.pyx":132
* if cached.lemma == 0:
* cached.lemma = self.lemmatize(rich_tag.pos, orth, attrs)
* self._cache.set(tag_id, orth, <void*>cached) # <<<<<<<<<<<<<<
*
* def load_morph_exceptions(self, dict exc):
*/
__pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_tag_id); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_v_orth); if (unlikely((__pyx_t_7 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *)__pyx_v_self->_cache->__pyx_vtab)->set(__pyx_v_self->_cache, __pyx_t_6, __pyx_t_7, ((void *)__pyx_v_cached)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "spacy\morphology.pyx":98
* flags[0] &= ~(one << flag_id)
*
* def add_special_case(self, unicode tag_str, unicode orth_str, attrs, force=False): # <<<<<<<<<<<<<<
* """
* Add a special-case rule to the morphological analyser. Tokens whose
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("spacy.morphology.Morphology.add_special_case", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tag);
__Pyx_XDECREF(__pyx_v_tag_id);
__Pyx_XDECREF(__pyx_v_orth);
__Pyx_XDECREF(__pyx_v_msg);
__Pyx_XDECREF(__pyx_v_name_id);
__Pyx_XDECREF(__pyx_v_value_id);
__Pyx_XDECREF(__pyx_v_attrs);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":134
* self._cache.set(tag_id, orth, <void*>cached)
*
* def load_morph_exceptions(self, dict exc): # <<<<<<<<<<<<<<
* # Map (form, pos) to (lemma, rich tag)
* for tag_str, entries in exc.items():
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7load_morph_exceptions(PyObject *__pyx_v_self, PyObject *__pyx_v_exc); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7load_morph_exceptions(PyObject *__pyx_v_self, PyObject *__pyx_v_exc) {
CYTHON_UNUSED int __pyx_lineno = 0;
CYTHON_UNUSED const char *__pyx_filename = NULL;
CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("load_morph_exceptions (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exc), (&PyDict_Type), 1, "exc", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_6load_morph_exceptions(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), ((PyObject*)__pyx_v_exc));
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_6load_morph_exceptions(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_exc) {
PyObject *__pyx_v_tag_str = NULL;
PyObject *__pyx_v_entries = NULL;
PyObject *__pyx_v_form_str = NULL;
PyObject *__pyx_v_attrs = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
PyObject *(*__pyx_t_4)(PyObject *);
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
Py_ssize_t __pyx_t_9;
PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
Py_ssize_t __pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("load_morph_exceptions", 0);
/* "spacy\morphology.pyx":136
* def load_morph_exceptions(self, dict exc):
* # Map (form, pos) to (lemma, rich tag)
* for tag_str, entries in exc.items(): # <<<<<<<<<<<<<<
* for form_str, attrs in entries.items():
* self.add_special_case(tag_str, form_str, attrs)
*/
if (unlikely(__pyx_v_exc == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_exc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (likely(!__pyx_t_4)) {
if (likely(PyList_CheckExact(__pyx_t_2))) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
} else {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
}
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_1);
}
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
#else
__pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_tag_str, __pyx_t_5);
__pyx_t_5 = 0;
__Pyx_XDECREF_SET(__pyx_v_entries, __pyx_t_6);
__pyx_t_6 = 0;
/* "spacy\morphology.pyx":137
* # Map (form, pos) to (lemma, rich tag)
* for tag_str, entries in exc.items():
* for form_str, attrs in entries.items(): # <<<<<<<<<<<<<<
* self.add_special_case(tag_str, form_str, attrs)
*
*/
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_entries, __pyx_n_s_items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_6, function);
}
}
if (__pyx_t_5) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
__pyx_t_10 = NULL;
} else {
__pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (likely(!__pyx_t_10)) {
if (likely(PyList_CheckExact(__pyx_t_6))) {
if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
} else {
if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
}
} else {
__pyx_t_1 = __pyx_t_10(__pyx_t_6);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_1);
}
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_7);
#else
__pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext;
index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L10_unpacking_done;
__pyx_L9_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L10_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_form_str, __pyx_t_5);
__pyx_t_5 = 0;
__Pyx_XDECREF_SET(__pyx_v_attrs, __pyx_t_7);
__pyx_t_7 = 0;
/* "spacy\morphology.pyx":138
* for tag_str, entries in exc.items():
* for form_str, attrs in entries.items():
* self.add_special_case(tag_str, form_str, attrs) # <<<<<<<<<<<<<<
*
* def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, morphology):
*/
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_special_case); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_5 = NULL;
__pyx_t_12 = 0;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
__pyx_t_12 = 1;
}
}
__pyx_t_11 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
if (__pyx_t_5) {
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL;
}
__Pyx_INCREF(__pyx_v_tag_str);
__Pyx_GIVEREF(__pyx_v_tag_str);
PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_12, __pyx_v_tag_str);
__Pyx_INCREF(__pyx_v_form_str);
__Pyx_GIVEREF(__pyx_v_form_str);
PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_12, __pyx_v_form_str);
__Pyx_INCREF(__pyx_v_attrs);
__Pyx_GIVEREF(__pyx_v_attrs);
PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_12, __pyx_v_attrs);
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "spacy\morphology.pyx":137
* # Map (form, pos) to (lemma, rich tag)
* for tag_str, entries in exc.items():
* for form_str, attrs in entries.items(): # <<<<<<<<<<<<<<
* self.add_special_case(tag_str, form_str, attrs)
*
*/
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "spacy\morphology.pyx":136
* def load_morph_exceptions(self, dict exc):
* # Map (form, pos) to (lemma, rich tag)
* for tag_str, entries in exc.items(): # <<<<<<<<<<<<<<
* for form_str, attrs in entries.items():
* self.add_special_case(tag_str, form_str, attrs)
*/
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "spacy\morphology.pyx":134
* self._cache.set(tag_id, orth, <void*>cached)
*
* def load_morph_exceptions(self, dict exc): # <<<<<<<<<<<<<<
* # Map (form, pos) to (lemma, rich tag)
* for tag_str, entries in exc.items():
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("spacy.morphology.Morphology.load_morph_exceptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tag_str);
__Pyx_XDECREF(__pyx_v_entries);
__Pyx_XDECREF(__pyx_v_form_str);
__Pyx_XDECREF(__pyx_v_attrs);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pyx":140
* self.add_special_case(tag_str, form_str, attrs)
*
* def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, morphology): # <<<<<<<<<<<<<<
* cdef unicode py_string = self.strings[orth]
* if self.lemmatizer is None:
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_9lemmatize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_9lemmatize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __pyx_v_univ_pos;
__pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth;
PyObject *__pyx_v_morphology = 0;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lemmatize (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_univ_pos,&__pyx_n_s_orth,&__pyx_n_s_morphology,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_univ_pos)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_orth)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("lemmatize", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_morphology)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("lemmatize", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lemmatize") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_univ_pos = ((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)__Pyx_PyInt_As_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_orth = __Pyx_PyInt_As_int32_t(values[1]); if (unlikely((__pyx_v_orth == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_morphology = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("lemmatize", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("spacy.morphology.Morphology.lemmatize", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_8lemmatize(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_univ_pos, __pyx_v_orth, __pyx_v_morphology);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_8lemmatize(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __pyx_v_univ_pos, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth, PyObject *__pyx_v_morphology) {
PyObject *__pyx_v_py_string = 0;
PyObject *__pyx_v_lemma_strings = 0;
PyObject *__pyx_v_lemma_string = 0;
PyObject *__pyx_v_lemma = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
Py_ssize_t __pyx_t_7;
PyObject *__pyx_t_8 = NULL;
int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lemmatize", 0);
/* "spacy\morphology.pyx":141
*
* def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, morphology):
* cdef unicode py_string = self.strings[orth] # <<<<<<<<<<<<<<
* if self.lemmatizer is None:
* return self.strings[py_string.lower()]
*/
__pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_orth, __pyx_t_5spacy_8typedefs_attr_t, 1, __Pyx_PyInt_From_int32_t, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_py_string = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":142
* def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, morphology):
* cdef unicode py_string = self.strings[orth]
* if self.lemmatizer is None: # <<<<<<<<<<<<<<
* return self.strings[py_string.lower()]
* if univ_pos not in (NOUN, VERB, ADJ, PUNCT):
*/
__pyx_t_2 = (__pyx_v_self->lemmatizer == Py_None);
__pyx_t_3 = (__pyx_t_2 != 0);
if (__pyx_t_3) {
/* "spacy\morphology.pyx":143
* cdef unicode py_string = self.strings[orth]
* if self.lemmatizer is None:
* return self.strings[py_string.lower()] # <<<<<<<<<<<<<<
* if univ_pos not in (NOUN, VERB, ADJ, PUNCT):
* return self.strings[py_string.lower()]
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_string, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
if (__pyx_t_5) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_t_1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "spacy\morphology.pyx":142
* def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, morphology):
* cdef unicode py_string = self.strings[orth]
* if self.lemmatizer is None: # <<<<<<<<<<<<<<
* return self.strings[py_string.lower()]
* if univ_pos not in (NOUN, VERB, ADJ, PUNCT):
*/
}
/* "spacy\morphology.pyx":144
* if self.lemmatizer is None:
* return self.strings[py_string.lower()]
* if univ_pos not in (NOUN, VERB, ADJ, PUNCT): # <<<<<<<<<<<<<<
* return self.strings[py_string.lower()]
* cdef set lemma_strings
*/
switch (__pyx_v_univ_pos) {
case __pyx_e_5spacy_15parts_of_speech_NOUN:
case __pyx_e_5spacy_15parts_of_speech_VERB:
case __pyx_e_5spacy_15parts_of_speech_ADJ:
case __pyx_e_5spacy_15parts_of_speech_PUNCT:
__pyx_t_3 = 0;
break;
default:
__pyx_t_3 = 1;
break;
}
__pyx_t_2 = (__pyx_t_3 != 0);
if (__pyx_t_2) {
/* "spacy\morphology.pyx":145
* return self.strings[py_string.lower()]
* if univ_pos not in (NOUN, VERB, ADJ, PUNCT):
* return self.strings[py_string.lower()] # <<<<<<<<<<<<<<
* cdef set lemma_strings
* cdef unicode lemma_string
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_string, __pyx_n_s_lower); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
}
}
if (__pyx_t_5) {
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_t_4); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "spacy\morphology.pyx":144
* if self.lemmatizer is None:
* return self.strings[py_string.lower()]
* if univ_pos not in (NOUN, VERB, ADJ, PUNCT): # <<<<<<<<<<<<<<
* return self.strings[py_string.lower()]
* cdef set lemma_strings
*/
}
/* "spacy\morphology.pyx":148
* cdef set lemma_strings
* cdef unicode lemma_string
* lemma_strings = self.lemmatizer(py_string, univ_pos, morphology) # <<<<<<<<<<<<<<
* lemma_string = sorted(lemma_strings)[0]
* lemma = self.strings[lemma_string]
*/
__pyx_t_4 = __Pyx_PyInt_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_v_univ_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_self->lemmatizer);
__pyx_t_5 = __pyx_v_self->lemmatizer; __pyx_t_6 = NULL;
__pyx_t_7 = 0;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_6)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
__pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
if (__pyx_t_6) {
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
}
__Pyx_INCREF(__pyx_v_py_string);
__Pyx_GIVEREF(__pyx_v_py_string);
PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_py_string);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
__Pyx_INCREF(__pyx_v_morphology);
__Pyx_GIVEREF(__pyx_v_morphology);
PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_morphology);
__pyx_t_4 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_lemma_strings = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
/* "spacy\morphology.pyx":149
* cdef unicode lemma_string
* lemma_strings = self.lemmatizer(py_string, univ_pos, morphology)
* lemma_string = sorted(lemma_strings)[0] # <<<<<<<<<<<<<<
* lemma = self.strings[lemma_string]
* return lemma
*/
__pyx_t_5 = PySequence_List(__pyx_v_lemma_strings); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_9 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__pyx_t_1 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_5 = __Pyx_GetItemInt_List(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_lemma_string = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
/* "spacy\morphology.pyx":150
* lemma_strings = self.lemmatizer(py_string, univ_pos, morphology)
* lemma_string = sorted(lemma_strings)[0]
* lemma = self.strings[lemma_string] # <<<<<<<<<<<<<<
* return lemma
*
*/
__pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_lemma_string); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_5);
__pyx_v_lemma = __pyx_t_5;
__pyx_t_5 = 0;
/* "spacy\morphology.pyx":151
* lemma_string = sorted(lemma_strings)[0]
* lemma = self.strings[lemma_string]
* return lemma # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_lemma);
__pyx_r = __pyx_v_lemma;
goto __pyx_L0;
/* "spacy\morphology.pyx":140
* self.add_special_case(tag_str, form_str, attrs)
*
* def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, morphology): # <<<<<<<<<<<<<<
* cdef unicode py_string = self.strings[orth]
* if self.lemmatizer is None:
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("spacy.morphology.Morphology.lemmatize", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_py_string);
__Pyx_XDECREF(__pyx_v_lemma_strings);
__Pyx_XDECREF(__pyx_v_lemma_string);
__Pyx_XDECREF(__pyx_v_lemma);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":26
*
* cdef class Morphology:
* cdef readonly Pool mem # <<<<<<<<<<<<<<
* cdef readonly StringStore strings
* cdef public object lemmatizer
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3mem_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3mem_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_3mem___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_3mem___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_self->mem));
__pyx_r = ((PyObject *)__pyx_v_self->mem);
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":27
* cdef class Morphology:
* cdef readonly Pool mem
* cdef readonly StringStore strings # <<<<<<<<<<<<<<
* cdef public object lemmatizer
* cdef readonly object tag_map
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7strings_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7strings_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_7strings___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_7strings___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_self->strings));
__pyx_r = ((PyObject *)__pyx_v_self->strings);
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":28
* cdef readonly Pool mem
* cdef readonly StringStore strings
* cdef public object lemmatizer # <<<<<<<<<<<<<<
* cdef readonly object tag_map
* cdef public object n_tags
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->lemmatizer);
__pyx_r = __pyx_v_self->lemmatizer;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer_2__set__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->lemmatizer);
__Pyx_DECREF(__pyx_v_self->lemmatizer);
__pyx_v_self->lemmatizer = __pyx_v_value;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_5__del__(PyObject *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer_4__del__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_10lemmatizer_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__", 0);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->lemmatizer);
__Pyx_DECREF(__pyx_v_self->lemmatizer);
__pyx_v_self->lemmatizer = Py_None;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":29
* cdef readonly StringStore strings
* cdef public object lemmatizer
* cdef readonly object tag_map # <<<<<<<<<<<<<<
* cdef public object n_tags
* cdef public object reverse_index
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7tag_map_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7tag_map_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_7tag_map___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_7tag_map___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->tag_map);
__pyx_r = __pyx_v_self->tag_map;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":30
* cdef public object lemmatizer
* cdef readonly object tag_map
* cdef public object n_tags # <<<<<<<<<<<<<<
* cdef public object reverse_index
* cdef public object tag_names
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_6n_tags_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_6n_tags_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_6n_tags___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_6n_tags___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->n_tags);
__pyx_r = __pyx_v_self->n_tags;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_6n_tags_2__set__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_6n_tags_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->n_tags);
__Pyx_DECREF(__pyx_v_self->n_tags);
__pyx_v_self->n_tags = __pyx_v_value;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_5__del__(PyObject *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_6n_tags_4__del__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_6n_tags_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__", 0);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->n_tags);
__Pyx_DECREF(__pyx_v_self->n_tags);
__pyx_v_self->n_tags = Py_None;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":31
* cdef readonly object tag_map
* cdef public object n_tags
* cdef public object reverse_index # <<<<<<<<<<<<<<
* cdef public object tag_names
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_13reverse_index___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->reverse_index);
__pyx_r = __pyx_v_self->reverse_index;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index_2__set__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->reverse_index);
__Pyx_DECREF(__pyx_v_self->reverse_index);
__pyx_v_self->reverse_index = __pyx_v_value;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_5__del__(PyObject *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index_4__del__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_13reverse_index_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__", 0);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->reverse_index);
__Pyx_DECREF(__pyx_v_self->reverse_index);
__pyx_v_self->reverse_index = Py_None;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "spacy\morphology.pxd":32
* cdef public object n_tags
* cdef public object reverse_index
* cdef public object tag_names # <<<<<<<<<<<<<<
*
* cdef RichTagC* rich_tags
*/
/* Python wrapper */
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_9tag_names_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_9tag_names_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_9tag_names___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_9tag_names___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->tag_names);
__pyx_r = __pyx_v_self->tag_names;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_9tag_names_2__set__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_9tag_names_2__set__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->tag_names);
__Pyx_DECREF(__pyx_v_self->tag_names);
__pyx_v_self->tag_names = __pyx_v_value;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_5__del__(PyObject *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_9tag_names_4__del__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5spacy_10morphology_10Morphology_9tag_names_4__del__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__", 0);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->tag_names);
__Pyx_DECREF(__pyx_v_self->tag_names);
__pyx_v_self->tag_names = Py_None;
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":197
* # experimental exception made for __getbuffer__ and __releasebuffer__
* # -- the details of this may change.
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
* # This implementation of getbuffer is geared towards Cython
* # requirements, and does not yet fullfill the PEP.
*/
/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
__pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_v_copy_shape;
int __pyx_v_i;
int __pyx_v_ndim;
int __pyx_v_endian_detector;
int __pyx_v_little_endian;
int __pyx_v_t;
char *__pyx_v_f;
PyArray_Descr *__pyx_v_descr = 0;
int __pyx_v_offset;
int __pyx_v_hasfields;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
char *__pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getbuffer__", 0);
if (__pyx_v_info != NULL) {
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
__Pyx_GIVEREF(__pyx_v_info->obj);
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":203
* # of flags
*
* if info == NULL: return # <<<<<<<<<<<<<<
*
* cdef int copy_shape, i, ndim
*/
__pyx_t_1 = ((__pyx_v_info == NULL) != 0);
if (__pyx_t_1) {
__pyx_r = 0;
goto __pyx_L0;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":206
*
* cdef int copy_shape, i, ndim
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
*
*/
__pyx_v_endian_detector = 1;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":207
* cdef int copy_shape, i, ndim
* cdef int endian_detector = 1
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
*
* ndim = PyArray_NDIM(self)
*/
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":209
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
*
* ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
*/
__pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":211
* ndim = PyArray_NDIM(self)
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
* copy_shape = 1
* else:
*/
__pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":212
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
* copy_shape = 1 # <<<<<<<<<<<<<<
* else:
* copy_shape = 0
*/
__pyx_v_copy_shape = 1;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":211
* ndim = PyArray_NDIM(self)
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
* copy_shape = 1
* else:
*/
goto __pyx_L4;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":214
* copy_shape = 1
* else:
* copy_shape = 0 # <<<<<<<<<<<<<<
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
*/
/*else*/ {
__pyx_v_copy_shape = 0;
}
__pyx_L4:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":216
* copy_shape = 0
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous")
*/
__pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L6_bool_binop_done;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":217
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
* raise ValueError(u"ndarray is not C contiguous")
*
*/
__pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L6_bool_binop_done:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":216
* copy_shape = 0
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous")
*/
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":218
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
*/
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":216
* copy_shape = 0
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous")
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":220
* raise ValueError(u"ndarray is not C contiguous")
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous")
*/
__pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L9_bool_binop_done;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":221
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
* raise ValueError(u"ndarray is not Fortran contiguous")
*
*/
__pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L9_bool_binop_done:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":220
* raise ValueError(u"ndarray is not C contiguous")
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous")
*/
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":222
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
*
* info.buf = PyArray_DATA(self)
*/
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":220
* raise ValueError(u"ndarray is not C contiguous")
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous")
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":224
* raise ValueError(u"ndarray is not Fortran contiguous")
*
* info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
* info.ndim = ndim
* if copy_shape:
*/
__pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":225
*
* info.buf = PyArray_DATA(self)
* info.ndim = ndim # <<<<<<<<<<<<<<
* if copy_shape:
* # Allocate new buffer for strides and shape info.
*/
__pyx_v_info->ndim = __pyx_v_ndim;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":226
* info.buf = PyArray_DATA(self)
* info.ndim = ndim
* if copy_shape: # <<<<<<<<<<<<<<
* # Allocate new buffer for strides and shape info.
* # This is allocated as one block, strides first.
*/
__pyx_t_1 = (__pyx_v_copy_shape != 0);
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":229
* # Allocate new buffer for strides and shape info.
* # This is allocated as one block, strides first.
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
* info.shape = info.strides + ndim
* for i in range(ndim):
*/
__pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":230
* # This is allocated as one block, strides first.
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
* info.shape = info.strides + ndim # <<<<<<<<<<<<<<
* for i in range(ndim):
* info.strides[i] = PyArray_STRIDES(self)[i]
*/
__pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":231
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
* info.shape = info.strides + ndim
* for i in range(ndim): # <<<<<<<<<<<<<<
* info.strides[i] = PyArray_STRIDES(self)[i]
* info.shape[i] = PyArray_DIMS(self)[i]
*/
__pyx_t_4 = __pyx_v_ndim;
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":232
* info.shape = info.strides + ndim
* for i in range(ndim):
* info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
* info.shape[i] = PyArray_DIMS(self)[i]
* else:
*/
(__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":233
* for i in range(ndim):
* info.strides[i] = PyArray_STRIDES(self)[i]
* info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
* else:
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
*/
(__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":226
* info.buf = PyArray_DATA(self)
* info.ndim = ndim
* if copy_shape: # <<<<<<<<<<<<<<
* # Allocate new buffer for strides and shape info.
* # This is allocated as one block, strides first.
*/
goto __pyx_L11;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":235
* info.shape[i] = PyArray_DIMS(self)[i]
* else:
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
* info.suboffsets = NULL
*/
/*else*/ {
__pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":236
* else:
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
* info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
* info.suboffsets = NULL
* info.itemsize = PyArray_ITEMSIZE(self)
*/
__pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
}
__pyx_L11:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":237
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
* info.suboffsets = NULL # <<<<<<<<<<<<<<
* info.itemsize = PyArray_ITEMSIZE(self)
* info.readonly = not PyArray_ISWRITEABLE(self)
*/
__pyx_v_info->suboffsets = NULL;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":238
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
* info.suboffsets = NULL
* info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
* info.readonly = not PyArray_ISWRITEABLE(self)
*
*/
__pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":239
* info.suboffsets = NULL
* info.itemsize = PyArray_ITEMSIZE(self)
* info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
*
* cdef int t
*/
__pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":242
*
* cdef int t
* cdef char* f = NULL # <<<<<<<<<<<<<<
* cdef dtype descr = self.descr
* cdef int offset
*/
__pyx_v_f = NULL;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":243
* cdef int t
* cdef char* f = NULL
* cdef dtype descr = self.descr # <<<<<<<<<<<<<<
* cdef int offset
*
*/
__pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
__Pyx_INCREF(__pyx_t_3);
__pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
__pyx_t_3 = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":246
* cdef int offset
*
* cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
*
* if not hasfields and not copy_shape:
*/
__pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":248
* cdef bint hasfields = PyDataType_HASFIELDS(descr)
*
* if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
* # do not call releasebuffer
* info.obj = None
*/
__pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L15_bool_binop_done;
}
__pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L15_bool_binop_done:;
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":250
* if not hasfields and not copy_shape:
* # do not call releasebuffer
* info.obj = None # <<<<<<<<<<<<<<
* else:
* # need to call releasebuffer
*/
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = Py_None;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":248
* cdef bint hasfields = PyDataType_HASFIELDS(descr)
*
* if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
* # do not call releasebuffer
* info.obj = None
*/
goto __pyx_L14;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":253
* else:
* # need to call releasebuffer
* info.obj = self # <<<<<<<<<<<<<<
*
* if not hasfields:
*/
/*else*/ {
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
}
__pyx_L14:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":255
* info.obj = self
*
* if not hasfields: # <<<<<<<<<<<<<<
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or
*/
__pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":256
*
* if not hasfields:
* t = descr.type_num # <<<<<<<<<<<<<<
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)):
*/
__pyx_t_4 = __pyx_v_descr->type_num;
__pyx_v_t = __pyx_t_4;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":257
* if not hasfields:
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
__pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
if (!__pyx_t_2) {
goto __pyx_L20_next_or;
} else {
}
__pyx_t_2 = (__pyx_v_little_endian != 0);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L19_bool_binop_done;
}
__pyx_L20_next_or:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":258
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
* raise ValueError(u"Non-native byte order not supported")
* if t == NPY_BYTE: f = "b"
*/
__pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L19_bool_binop_done;
}
__pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L19_bool_binop_done:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":257
* if not hasfields:
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":259
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B"
*/
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":257
* if not hasfields:
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":260
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
* if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
* elif t == NPY_UBYTE: f = "B"
* elif t == NPY_SHORT: f = "h"
*/
switch (__pyx_v_t) {
case NPY_BYTE:
__pyx_v_f = __pyx_k_b;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":261
* raise ValueError(u"Non-native byte order not supported")
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
* elif t == NPY_SHORT: f = "h"
* elif t == NPY_USHORT: f = "H"
*/
case NPY_UBYTE:
__pyx_v_f = __pyx_k_B;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":262
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B"
* elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
* elif t == NPY_USHORT: f = "H"
* elif t == NPY_INT: f = "i"
*/
case NPY_SHORT:
__pyx_v_f = __pyx_k_h;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":263
* elif t == NPY_UBYTE: f = "B"
* elif t == NPY_SHORT: f = "h"
* elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
* elif t == NPY_INT: f = "i"
* elif t == NPY_UINT: f = "I"
*/
case NPY_USHORT:
__pyx_v_f = __pyx_k_H;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":264
* elif t == NPY_SHORT: f = "h"
* elif t == NPY_USHORT: f = "H"
* elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
* elif t == NPY_UINT: f = "I"
* elif t == NPY_LONG: f = "l"
*/
case NPY_INT:
__pyx_v_f = __pyx_k_i;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":265
* elif t == NPY_USHORT: f = "H"
* elif t == NPY_INT: f = "i"
* elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
* elif t == NPY_LONG: f = "l"
* elif t == NPY_ULONG: f = "L"
*/
case NPY_UINT:
__pyx_v_f = __pyx_k_I;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":266
* elif t == NPY_INT: f = "i"
* elif t == NPY_UINT: f = "I"
* elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
* elif t == NPY_ULONG: f = "L"
* elif t == NPY_LONGLONG: f = "q"
*/
case NPY_LONG:
__pyx_v_f = __pyx_k_l;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":267
* elif t == NPY_UINT: f = "I"
* elif t == NPY_LONG: f = "l"
* elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
* elif t == NPY_LONGLONG: f = "q"
* elif t == NPY_ULONGLONG: f = "Q"
*/
case NPY_ULONG:
__pyx_v_f = __pyx_k_L;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":268
* elif t == NPY_LONG: f = "l"
* elif t == NPY_ULONG: f = "L"
* elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
* elif t == NPY_ULONGLONG: f = "Q"
* elif t == NPY_FLOAT: f = "f"
*/
case NPY_LONGLONG:
__pyx_v_f = __pyx_k_q;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":269
* elif t == NPY_ULONG: f = "L"
* elif t == NPY_LONGLONG: f = "q"
* elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
* elif t == NPY_FLOAT: f = "f"
* elif t == NPY_DOUBLE: f = "d"
*/
case NPY_ULONGLONG:
__pyx_v_f = __pyx_k_Q;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":270
* elif t == NPY_LONGLONG: f = "q"
* elif t == NPY_ULONGLONG: f = "Q"
* elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
* elif t == NPY_DOUBLE: f = "d"
* elif t == NPY_LONGDOUBLE: f = "g"
*/
case NPY_FLOAT:
__pyx_v_f = __pyx_k_f;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":271
* elif t == NPY_ULONGLONG: f = "Q"
* elif t == NPY_FLOAT: f = "f"
* elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
* elif t == NPY_LONGDOUBLE: f = "g"
* elif t == NPY_CFLOAT: f = "Zf"
*/
case NPY_DOUBLE:
__pyx_v_f = __pyx_k_d;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":272
* elif t == NPY_FLOAT: f = "f"
* elif t == NPY_DOUBLE: f = "d"
* elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
* elif t == NPY_CFLOAT: f = "Zf"
* elif t == NPY_CDOUBLE: f = "Zd"
*/
case NPY_LONGDOUBLE:
__pyx_v_f = __pyx_k_g;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":273
* elif t == NPY_DOUBLE: f = "d"
* elif t == NPY_LONGDOUBLE: f = "g"
* elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
* elif t == NPY_CDOUBLE: f = "Zd"
* elif t == NPY_CLONGDOUBLE: f = "Zg"
*/
case NPY_CFLOAT:
__pyx_v_f = __pyx_k_Zf;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":274
* elif t == NPY_LONGDOUBLE: f = "g"
* elif t == NPY_CFLOAT: f = "Zf"
* elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
* elif t == NPY_CLONGDOUBLE: f = "Zg"
* elif t == NPY_OBJECT: f = "O"
*/
case NPY_CDOUBLE:
__pyx_v_f = __pyx_k_Zd;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":275
* elif t == NPY_CFLOAT: f = "Zf"
* elif t == NPY_CDOUBLE: f = "Zd"
* elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
* elif t == NPY_OBJECT: f = "O"
* else:
*/
case NPY_CLONGDOUBLE:
__pyx_v_f = __pyx_k_Zg;
break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":276
* elif t == NPY_CDOUBLE: f = "Zd"
* elif t == NPY_CLONGDOUBLE: f = "Zg"
* elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
*/
case NPY_OBJECT:
__pyx_v_f = __pyx_k_O;
break;
default:
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":278
* elif t == NPY_OBJECT: f = "O"
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
* info.format = f
* return
*/
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
break;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":279
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
* info.format = f # <<<<<<<<<<<<<<
* return
* else:
*/
__pyx_v_info->format = __pyx_v_f;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":280
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
* info.format = f
* return # <<<<<<<<<<<<<<
* else:
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
*/
__pyx_r = 0;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":255
* info.obj = self
*
* if not hasfields: # <<<<<<<<<<<<<<
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":282
* return
* else:
* info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
* info.format[0] = c'^' # Native data types, manual alignment
* offset = 0
*/
/*else*/ {
__pyx_v_info->format = ((char *)malloc(0xFF));
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":283
* else:
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
* info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
* offset = 0
* f = _util_dtypestring(descr, info.format + 1,
*/
(__pyx_v_info->format[0]) = '^';
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":284
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
* info.format[0] = c'^' # Native data types, manual alignment
* offset = 0 # <<<<<<<<<<<<<<
* f = _util_dtypestring(descr, info.format + 1,
* info.format + _buffer_format_string_len,
*/
__pyx_v_offset = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":285
* info.format[0] = c'^' # Native data types, manual alignment
* offset = 0
* f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
* info.format + _buffer_format_string_len,
* &offset)
*/
__pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f = __pyx_t_7;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":288
* info.format + _buffer_format_string_len,
* &offset)
* f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
*
* def __releasebuffer__(ndarray self, Py_buffer* info):
*/
(__pyx_v_f[0]) = '\x00';
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":197
* # experimental exception made for __getbuffer__ and __releasebuffer__
* # -- the details of this may change.
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
* # This implementation of getbuffer is geared towards Cython
* # requirements, and does not yet fullfill the PEP.
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
}
goto __pyx_L2;
__pyx_L0:;
if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
__Pyx_GOTREF(Py_None);
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
}
__pyx_L2:;
__Pyx_XDECREF((PyObject *)__pyx_v_descr);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":290
* f[0] = c'\0' # Terminate format string
*
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format)
*/
/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__releasebuffer__", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":291
*
* def __releasebuffer__(ndarray self, Py_buffer* info):
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
*/
__pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":292
* def __releasebuffer__(ndarray self, Py_buffer* info):
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format) # <<<<<<<<<<<<<<
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
* stdlib.free(info.strides)
*/
free(__pyx_v_info->format);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":291
*
* def __releasebuffer__(ndarray self, Py_buffer* info):
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":293
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
* stdlib.free(info.strides)
* # info.shape was stored after info.strides in the same block
*/
__pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":294
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
* stdlib.free(info.strides) # <<<<<<<<<<<<<<
* # info.shape was stored after info.strides in the same block
*
*/
free(__pyx_v_info->strides);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":293
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
* stdlib.free(info.strides)
* # info.shape was stored after info.strides in the same block
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":290
* f[0] = c'\0' # Terminate format string
*
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format)
*/
/* function exit code */
__Pyx_RefNannyFinishContext();
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":770
* ctypedef npy_cdouble complex_t
*
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(1, <void*>a)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":771
*
* cdef inline object PyArray_MultiIterNew1(a):
* return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew2(a, b):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":770
* ctypedef npy_cdouble complex_t
*
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(1, <void*>a)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":773
* return PyArray_MultiIterNew(1, <void*>a)
*
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":774
*
* cdef inline object PyArray_MultiIterNew2(a, b):
* return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew3(a, b, c):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":773
* return PyArray_MultiIterNew(1, <void*>a)
*
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":776
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
*
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":777
*
* cdef inline object PyArray_MultiIterNew3(a, b, c):
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":776
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
*
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":779
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":780
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":779
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":782
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":783
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
*
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":782
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":785
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
*
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
* # Recursive utility function used in __getbuffer__ to get format
* # string. The new location in the format string is returned.
*/
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
PyArray_Descr *__pyx_v_child = 0;
int __pyx_v_endian_detector;
int __pyx_v_little_endian;
PyObject *__pyx_v_fields = 0;
PyObject *__pyx_v_childname = NULL;
PyObject *__pyx_v_new_offset = NULL;
PyObject *__pyx_v_t = NULL;
char *__pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
long __pyx_t_8;
char *__pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_util_dtypestring", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":790
*
* cdef dtype child
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
* cdef tuple fields
*/
__pyx_v_endian_detector = 1;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":791
* cdef dtype child
* cdef int endian_detector = 1
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
* cdef tuple fields
*
*/
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":794
* cdef tuple fields
*
* for childname in descr.names: # <<<<<<<<<<<<<<
* fields = descr.fields[childname]
* child, new_offset = fields
*/
if (unlikely(__pyx_v_descr->names == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
__pyx_t_3 = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":795
*
* for childname in descr.names:
* fields = descr.fields[childname] # <<<<<<<<<<<<<<
* child, new_offset = fields
*
*/
if (unlikely(__pyx_v_descr->fields == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
__pyx_t_3 = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":796
* for childname in descr.names:
* fields = descr.fields[childname]
* child, new_offset = fields # <<<<<<<<<<<<<<
*
* if (end - f) - <int>(new_offset - offset[0]) < 15:
*/
if (likely(__pyx_v_fields != Py_None)) {
PyObject* sequence = __pyx_v_fields;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
#endif
} else {
__Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
__pyx_t_3 = 0;
__Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
__pyx_t_4 = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":798
* child, new_offset = fields
*
* if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
*/
__pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
if (__pyx_t_6) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":799
*
* if (end - f) - <int>(new_offset - offset[0]) < 15:
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
*
* if ((child.byteorder == c'>' and little_endian) or
*/
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":798
* child, new_offset = fields
*
* if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":801
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
__pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
if (!__pyx_t_7) {
goto __pyx_L8_next_or;
} else {
}
__pyx_t_7 = (__pyx_v_little_endian != 0);
if (!__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L7_bool_binop_done;
}
__pyx_L8_next_or:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":802
*
* if ((child.byteorder == c'>' and little_endian) or
* (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
* raise ValueError(u"Non-native byte order not supported")
* # One could encode it in the format string and have Cython
*/
__pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
if (__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L7_bool_binop_done;
}
__pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
__pyx_t_6 = __pyx_t_7;
__pyx_L7_bool_binop_done:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":801
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
if (__pyx_t_6) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":803
* if ((child.byteorder == c'>' and little_endian) or
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* # One could encode it in the format string and have Cython
* # complain instead, BUT: < and > in format strings also imply
*/
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":801
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":813
*
* # Output padding bytes
* while offset[0] < new_offset: # <<<<<<<<<<<<<<
* f[0] = 120 # "x"; pad byte
* f += 1
*/
while (1) {
__pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (!__pyx_t_6) break;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":814
* # Output padding bytes
* while offset[0] < new_offset:
* f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
* f += 1
* offset[0] += 1
*/
(__pyx_v_f[0]) = 0x78;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":815
* while offset[0] < new_offset:
* f[0] = 120 # "x"; pad byte
* f += 1 # <<<<<<<<<<<<<<
* offset[0] += 1
*
*/
__pyx_v_f = (__pyx_v_f + 1);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":816
* f[0] = 120 # "x"; pad byte
* f += 1
* offset[0] += 1 # <<<<<<<<<<<<<<
*
* offset[0] += child.itemsize
*/
__pyx_t_8 = 0;
(__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":818
* offset[0] += 1
*
* offset[0] += child.itemsize # <<<<<<<<<<<<<<
*
* if not PyDataType_HASFIELDS(child):
*/
__pyx_t_8 = 0;
(__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":820
* offset[0] += child.itemsize
*
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
* t = child.type_num
* if end - f < 5:
*/
__pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
if (__pyx_t_6) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":821
*
* if not PyDataType_HASFIELDS(child):
* t = child.type_num # <<<<<<<<<<<<<<
* if end - f < 5:
* raise RuntimeError(u"Format string allocated too short.")
*/
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
__pyx_t_4 = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":822
* if not PyDataType_HASFIELDS(child):
* t = child.type_num
* if end - f < 5: # <<<<<<<<<<<<<<
* raise RuntimeError(u"Format string allocated too short.")
*
*/
__pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
if (__pyx_t_6) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":823
* t = child.type_num
* if end - f < 5:
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
*
* # Until ticket #99 is fixed, use integers to avoid warnings
*/
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":822
* if not PyDataType_HASFIELDS(child):
* t = child.type_num
* if end - f < 5: # <<<<<<<<<<<<<<
* raise RuntimeError(u"Format string allocated too short.")
*
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":826
*
* # Until ticket #99 is fixed, use integers to avoid warnings
* if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
* elif t == NPY_UBYTE: f[0] = 66 #"B"
* elif t == NPY_SHORT: f[0] = 104 #"h"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 98;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":827
* # Until ticket #99 is fixed, use integers to avoid warnings
* if t == NPY_BYTE: f[0] = 98 #"b"
* elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
* elif t == NPY_SHORT: f[0] = 104 #"h"
* elif t == NPY_USHORT: f[0] = 72 #"H"
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 66;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":828
* if t == NPY_BYTE: f[0] = 98 #"b"
* elif t == NPY_UBYTE: f[0] = 66 #"B"
* elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
* elif t == NPY_USHORT: f[0] = 72 #"H"
* elif t == NPY_INT: f[0] = 105 #"i"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x68;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":829
* elif t == NPY_UBYTE: f[0] = 66 #"B"
* elif t == NPY_SHORT: f[0] = 104 #"h"
* elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
* elif t == NPY_INT: f[0] = 105 #"i"
* elif t == NPY_UINT: f[0] = 73 #"I"
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 72;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":830
* elif t == NPY_SHORT: f[0] = 104 #"h"
* elif t == NPY_USHORT: f[0] = 72 #"H"
* elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
* elif t == NPY_UINT: f[0] = 73 #"I"
* elif t == NPY_LONG: f[0] = 108 #"l"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x69;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":831
* elif t == NPY_USHORT: f[0] = 72 #"H"
* elif t == NPY_INT: f[0] = 105 #"i"
* elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
* elif t == NPY_LONG: f[0] = 108 #"l"
* elif t == NPY_ULONG: f[0] = 76 #"L"
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 73;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":832
* elif t == NPY_INT: f[0] = 105 #"i"
* elif t == NPY_UINT: f[0] = 73 #"I"
* elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
* elif t == NPY_ULONG: f[0] = 76 #"L"
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x6C;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":833
* elif t == NPY_UINT: f[0] = 73 #"I"
* elif t == NPY_LONG: f[0] = 108 #"l"
* elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 76;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":834
* elif t == NPY_LONG: f[0] = 108 #"l"
* elif t == NPY_ULONG: f[0] = 76 #"L"
* elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
* elif t == NPY_FLOAT: f[0] = 102 #"f"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x71;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":835
* elif t == NPY_ULONG: f[0] = 76 #"L"
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
* elif t == NPY_FLOAT: f[0] = 102 #"f"
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 81;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":836
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
* elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x66;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":837
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
* elif t == NPY_FLOAT: f[0] = 102 #"f"
* elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x64;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":838
* elif t == NPY_FLOAT: f[0] = 102 #"f"
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 0x67;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":839
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 90;
(__pyx_v_f[1]) = 0x66;
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":840
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
* elif t == NPY_OBJECT: f[0] = 79 #"O"
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 90;
(__pyx_v_f[1]) = 0x64;
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":841
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
* elif t == NPY_OBJECT: f[0] = 79 #"O"
* else:
*/
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 90;
(__pyx_v_f[1]) = 0x67;
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":842
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
* elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
*/
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_6) {
(__pyx_v_f[0]) = 79;
goto __pyx_L15;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":844
* elif t == NPY_OBJECT: f[0] = 79 #"O"
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
* f += 1
* else:
*/
/*else*/ {
__pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L15:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":845
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
* f += 1 # <<<<<<<<<<<<<<
* else:
* # Cython ignores struct boundary information ("T{...}"),
*/
__pyx_v_f = (__pyx_v_f + 1);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":820
* offset[0] += child.itemsize
*
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
* t = child.type_num
* if end - f < 5:
*/
goto __pyx_L13;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":849
* # Cython ignores struct boundary information ("T{...}"),
* # so don't output it
* f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
* return f
*
*/
/*else*/ {
__pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f = __pyx_t_9;
}
__pyx_L13:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":794
* cdef tuple fields
*
* for childname in descr.names: # <<<<<<<<<<<<<<
* fields = descr.fields[childname]
* child, new_offset = fields
*/
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":850
* # so don't output it
* f = _util_dtypestring(child, f, end, offset)
* return f # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_f;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":785
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
*
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
* # Recursive utility function used in __getbuffer__ to get format
* # string. The new location in the format string is returned.
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_child);
__Pyx_XDECREF(__pyx_v_fields);
__Pyx_XDECREF(__pyx_v_childname);
__Pyx_XDECREF(__pyx_v_new_offset);
__Pyx_XDECREF(__pyx_v_t);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":966
*
*
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
* cdef PyObject* baseptr
* if base is None:
*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
PyObject *__pyx_v_baseptr;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
__Pyx_RefNannySetupContext("set_array_base", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":968
* cdef inline void set_array_base(ndarray arr, object base):
* cdef PyObject* baseptr
* if base is None: # <<<<<<<<<<<<<<
* baseptr = NULL
* else:
*/
__pyx_t_1 = (__pyx_v_base == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":969
* cdef PyObject* baseptr
* if base is None:
* baseptr = NULL # <<<<<<<<<<<<<<
* else:
* Py_INCREF(base) # important to do this before decref below!
*/
__pyx_v_baseptr = NULL;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":968
* cdef inline void set_array_base(ndarray arr, object base):
* cdef PyObject* baseptr
* if base is None: # <<<<<<<<<<<<<<
* baseptr = NULL
* else:
*/
goto __pyx_L3;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":971
* baseptr = NULL
* else:
* Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
* baseptr = <PyObject*>base
* Py_XDECREF(arr.base)
*/
/*else*/ {
Py_INCREF(__pyx_v_base);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":972
* else:
* Py_INCREF(base) # important to do this before decref below!
* baseptr = <PyObject*>base # <<<<<<<<<<<<<<
* Py_XDECREF(arr.base)
* arr.base = baseptr
*/
__pyx_v_baseptr = ((PyObject *)__pyx_v_base);
}
__pyx_L3:;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":973
* Py_INCREF(base) # important to do this before decref below!
* baseptr = <PyObject*>base
* Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
* arr.base = baseptr
*
*/
Py_XDECREF(__pyx_v_arr->base);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":974
* baseptr = <PyObject*>base
* Py_XDECREF(arr.base)
* arr.base = baseptr # <<<<<<<<<<<<<<
*
* cdef inline object get_array_base(ndarray arr):
*/
__pyx_v_arr->base = __pyx_v_baseptr;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":966
*
*
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
* cdef PyObject* baseptr
* if base is None:
*/
/* function exit code */
__Pyx_RefNannyFinishContext();
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":976
* arr.base = baseptr
*
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
* if arr.base is NULL:
* return None
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("get_array_base", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":977
*
* cdef inline object get_array_base(ndarray arr):
* if arr.base is NULL: # <<<<<<<<<<<<<<
* return None
* else:
*/
__pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
if (__pyx_t_1) {
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":978
* cdef inline object get_array_base(ndarray arr):
* if arr.base is NULL:
* return None # <<<<<<<<<<<<<<
* else:
* return <object>arr.base
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L0;
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":977
*
* cdef inline object get_array_base(ndarray arr):
* if arr.base is NULL: # <<<<<<<<<<<<<<
* return None
* else:
*/
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":980
* return None
* else:
* return <object>arr.base # <<<<<<<<<<<<<<
*/
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
__pyx_r = ((PyObject *)__pyx_v_arr->base);
goto __pyx_L0;
}
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":976
* arr.base = baseptr
*
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
* if arr.base is NULL:
* return None
*/
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "lexeme.pxd":20
*
* @staticmethod
* cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length): # <<<<<<<<<<<<<<
* cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth)
* self.c = lex
*/
static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, CYTHON_UNUSED int __pyx_v_vector_length) {
struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0;
struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__pyx_t_5spacy_8typedefs_attr_t __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("from_ptr", 0);
/* "lexeme.pxd":21
* @staticmethod
* cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length):
* cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<<
* self.c = lex
* self.vocab = vocab
*/
__pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_v_vocab));
__Pyx_GIVEREF(((PyObject *)__pyx_v_vocab));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab));
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5spacy_6lexeme_Lexeme)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1);
__pyx_t_1 = 0;
/* "lexeme.pxd":22
* cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length):
* cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth)
* self.c = lex # <<<<<<<<<<<<<<
* self.vocab = vocab
* self.orth = lex.orth
*/
__pyx_v_self->c = __pyx_v_lex;
/* "lexeme.pxd":23
* cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth)
* self.c = lex
* self.vocab = vocab # <<<<<<<<<<<<<<
* self.orth = lex.orth
*
*/
__Pyx_INCREF(((PyObject *)__pyx_v_vocab));
__Pyx_GIVEREF(((PyObject *)__pyx_v_vocab));
__Pyx_GOTREF(__pyx_v_self->vocab);
__Pyx_DECREF(((PyObject *)__pyx_v_self->vocab));
__pyx_v_self->vocab = __pyx_v_vocab;
/* "lexeme.pxd":24
* self.c = lex
* self.vocab = vocab
* self.orth = lex.orth # <<<<<<<<<<<<<<
*
* @staticmethod
*/
__pyx_t_3 = __pyx_v_lex->orth;
__pyx_v_self->orth = __pyx_t_3;
/* "lexeme.pxd":20
*
* @staticmethod
* cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length): # <<<<<<<<<<<<<<
* cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth)
* self.c = lex
*/
/* function exit code */
__pyx_r = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_self);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "lexeme.pxd":27
*
* @staticmethod
* cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil: # <<<<<<<<<<<<<<
* if name < (sizeof(flags_t) * 8):
* Lexeme.c_set_flag(lex, name, value)
*/
static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) {
int __pyx_t_1;
/* "lexeme.pxd":28
* @staticmethod
* cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil:
* if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<<
* Lexeme.c_set_flag(lex, name, value)
* elif name == ID:
*/
__pyx_t_1 = ((__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":29
* cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil:
* if name < (sizeof(flags_t) * 8):
* Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<<
* elif name == ID:
* lex.id = value
*/
__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value);
/* "lexeme.pxd":28
* @staticmethod
* cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil:
* if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<<
* Lexeme.c_set_flag(lex, name, value)
* elif name == ID:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":30
* if name < (sizeof(flags_t) * 8):
* Lexeme.c_set_flag(lex, name, value)
* elif name == ID: # <<<<<<<<<<<<<<
* lex.id = value
* elif name == LOWER:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_ID) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":31
* Lexeme.c_set_flag(lex, name, value)
* elif name == ID:
* lex.id = value # <<<<<<<<<<<<<<
* elif name == LOWER:
* lex.lower = value
*/
__pyx_v_lex->id = __pyx_v_value;
/* "lexeme.pxd":30
* if name < (sizeof(flags_t) * 8):
* Lexeme.c_set_flag(lex, name, value)
* elif name == ID: # <<<<<<<<<<<<<<
* lex.id = value
* elif name == LOWER:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":32
* elif name == ID:
* lex.id = value
* elif name == LOWER: # <<<<<<<<<<<<<<
* lex.lower = value
* elif name == NORM:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":33
* lex.id = value
* elif name == LOWER:
* lex.lower = value # <<<<<<<<<<<<<<
* elif name == NORM:
* lex.norm = value
*/
__pyx_v_lex->lower = __pyx_v_value;
/* "lexeme.pxd":32
* elif name == ID:
* lex.id = value
* elif name == LOWER: # <<<<<<<<<<<<<<
* lex.lower = value
* elif name == NORM:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":34
* elif name == LOWER:
* lex.lower = value
* elif name == NORM: # <<<<<<<<<<<<<<
* lex.norm = value
* elif name == SHAPE:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_NORM) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":35
* lex.lower = value
* elif name == NORM:
* lex.norm = value # <<<<<<<<<<<<<<
* elif name == SHAPE:
* lex.shape = value
*/
__pyx_v_lex->norm = __pyx_v_value;
/* "lexeme.pxd":34
* elif name == LOWER:
* lex.lower = value
* elif name == NORM: # <<<<<<<<<<<<<<
* lex.norm = value
* elif name == SHAPE:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":36
* elif name == NORM:
* lex.norm = value
* elif name == SHAPE: # <<<<<<<<<<<<<<
* lex.shape = value
* elif name == PREFIX:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":37
* lex.norm = value
* elif name == SHAPE:
* lex.shape = value # <<<<<<<<<<<<<<
* elif name == PREFIX:
* lex.prefix = value
*/
__pyx_v_lex->shape = __pyx_v_value;
/* "lexeme.pxd":36
* elif name == NORM:
* lex.norm = value
* elif name == SHAPE: # <<<<<<<<<<<<<<
* lex.shape = value
* elif name == PREFIX:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":38
* elif name == SHAPE:
* lex.shape = value
* elif name == PREFIX: # <<<<<<<<<<<<<<
* lex.prefix = value
* elif name == SUFFIX:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":39
* lex.shape = value
* elif name == PREFIX:
* lex.prefix = value # <<<<<<<<<<<<<<
* elif name == SUFFIX:
* lex.suffix = value
*/
__pyx_v_lex->prefix = __pyx_v_value;
/* "lexeme.pxd":38
* elif name == SHAPE:
* lex.shape = value
* elif name == PREFIX: # <<<<<<<<<<<<<<
* lex.prefix = value
* elif name == SUFFIX:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":40
* elif name == PREFIX:
* lex.prefix = value
* elif name == SUFFIX: # <<<<<<<<<<<<<<
* lex.suffix = value
* elif name == CLUSTER:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":41
* lex.prefix = value
* elif name == SUFFIX:
* lex.suffix = value # <<<<<<<<<<<<<<
* elif name == CLUSTER:
* lex.cluster = value
*/
__pyx_v_lex->suffix = __pyx_v_value;
/* "lexeme.pxd":40
* elif name == PREFIX:
* lex.prefix = value
* elif name == SUFFIX: # <<<<<<<<<<<<<<
* lex.suffix = value
* elif name == CLUSTER:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":42
* elif name == SUFFIX:
* lex.suffix = value
* elif name == CLUSTER: # <<<<<<<<<<<<<<
* lex.cluster = value
* elif name == LANG:
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_CLUSTER) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":43
* lex.suffix = value
* elif name == CLUSTER:
* lex.cluster = value # <<<<<<<<<<<<<<
* elif name == LANG:
* lex.lang = value
*/
__pyx_v_lex->cluster = __pyx_v_value;
/* "lexeme.pxd":42
* elif name == SUFFIX:
* lex.suffix = value
* elif name == CLUSTER: # <<<<<<<<<<<<<<
* lex.cluster = value
* elif name == LANG:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":44
* elif name == CLUSTER:
* lex.cluster = value
* elif name == LANG: # <<<<<<<<<<<<<<
* lex.lang = value
*
*/
__pyx_t_1 = ((__pyx_v_name == __pyx_e_5spacy_5attrs_LANG) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":45
* lex.cluster = value
* elif name == LANG:
* lex.lang = value # <<<<<<<<<<<<<<
*
* @staticmethod
*/
__pyx_v_lex->lang = __pyx_v_value;
/* "lexeme.pxd":44
* elif name == CLUSTER:
* lex.cluster = value
* elif name == LANG: # <<<<<<<<<<<<<<
* lex.lang = value
*
*/
}
__pyx_L3:;
/* "lexeme.pxd":27
*
* @staticmethod
* cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil: # <<<<<<<<<<<<<<
* if name < (sizeof(flags_t) * 8):
* Lexeme.c_set_flag(lex, name, value)
*/
/* function exit code */
}
/* "lexeme.pxd":48
*
* @staticmethod
* cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil: # <<<<<<<<<<<<<<
* if feat_name < (sizeof(flags_t) * 8):
* if Lexeme.c_check_flag(lex, feat_name):
*/
static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) {
__pyx_t_5spacy_8typedefs_attr_t __pyx_r;
int __pyx_t_1;
/* "lexeme.pxd":49
* @staticmethod
* cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil:
* if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<<
* if Lexeme.c_check_flag(lex, feat_name):
* return 1
*/
__pyx_t_1 = ((__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":50
* cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil:
* if feat_name < (sizeof(flags_t) * 8):
* if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<<
* return 1
* else:
*/
__pyx_t_1 = (__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":51
* if feat_name < (sizeof(flags_t) * 8):
* if Lexeme.c_check_flag(lex, feat_name):
* return 1 # <<<<<<<<<<<<<<
* else:
* return 0
*/
__pyx_r = 1;
goto __pyx_L0;
/* "lexeme.pxd":50
* cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil:
* if feat_name < (sizeof(flags_t) * 8):
* if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<<
* return 1
* else:
*/
}
/* "lexeme.pxd":53
* return 1
* else:
* return 0 # <<<<<<<<<<<<<<
* elif feat_name == ID:
* return lex.id
*/
/*else*/ {
__pyx_r = 0;
goto __pyx_L0;
}
/* "lexeme.pxd":49
* @staticmethod
* cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil:
* if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<<
* if Lexeme.c_check_flag(lex, feat_name):
* return 1
*/
}
/* "lexeme.pxd":54
* else:
* return 0
* elif feat_name == ID: # <<<<<<<<<<<<<<
* return lex.id
* elif feat_name == ORTH:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":55
* return 0
* elif feat_name == ID:
* return lex.id # <<<<<<<<<<<<<<
* elif feat_name == ORTH:
* return lex.orth
*/
__pyx_r = __pyx_v_lex->id;
goto __pyx_L0;
/* "lexeme.pxd":54
* else:
* return 0
* elif feat_name == ID: # <<<<<<<<<<<<<<
* return lex.id
* elif feat_name == ORTH:
*/
}
/* "lexeme.pxd":56
* elif feat_name == ID:
* return lex.id
* elif feat_name == ORTH: # <<<<<<<<<<<<<<
* return lex.orth
* elif feat_name == LOWER:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":57
* return lex.id
* elif feat_name == ORTH:
* return lex.orth # <<<<<<<<<<<<<<
* elif feat_name == LOWER:
* return lex.lower
*/
__pyx_r = __pyx_v_lex->orth;
goto __pyx_L0;
/* "lexeme.pxd":56
* elif feat_name == ID:
* return lex.id
* elif feat_name == ORTH: # <<<<<<<<<<<<<<
* return lex.orth
* elif feat_name == LOWER:
*/
}
/* "lexeme.pxd":58
* elif feat_name == ORTH:
* return lex.orth
* elif feat_name == LOWER: # <<<<<<<<<<<<<<
* return lex.lower
* elif feat_name == NORM:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":59
* return lex.orth
* elif feat_name == LOWER:
* return lex.lower # <<<<<<<<<<<<<<
* elif feat_name == NORM:
* return lex.norm
*/
__pyx_r = __pyx_v_lex->lower;
goto __pyx_L0;
/* "lexeme.pxd":58
* elif feat_name == ORTH:
* return lex.orth
* elif feat_name == LOWER: # <<<<<<<<<<<<<<
* return lex.lower
* elif feat_name == NORM:
*/
}
/* "lexeme.pxd":60
* elif feat_name == LOWER:
* return lex.lower
* elif feat_name == NORM: # <<<<<<<<<<<<<<
* return lex.norm
* elif feat_name == SHAPE:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":61
* return lex.lower
* elif feat_name == NORM:
* return lex.norm # <<<<<<<<<<<<<<
* elif feat_name == SHAPE:
* return lex.shape
*/
__pyx_r = __pyx_v_lex->norm;
goto __pyx_L0;
/* "lexeme.pxd":60
* elif feat_name == LOWER:
* return lex.lower
* elif feat_name == NORM: # <<<<<<<<<<<<<<
* return lex.norm
* elif feat_name == SHAPE:
*/
}
/* "lexeme.pxd":62
* elif feat_name == NORM:
* return lex.norm
* elif feat_name == SHAPE: # <<<<<<<<<<<<<<
* return lex.shape
* elif feat_name == PREFIX:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":63
* return lex.norm
* elif feat_name == SHAPE:
* return lex.shape # <<<<<<<<<<<<<<
* elif feat_name == PREFIX:
* return lex.prefix
*/
__pyx_r = __pyx_v_lex->shape;
goto __pyx_L0;
/* "lexeme.pxd":62
* elif feat_name == NORM:
* return lex.norm
* elif feat_name == SHAPE: # <<<<<<<<<<<<<<
* return lex.shape
* elif feat_name == PREFIX:
*/
}
/* "lexeme.pxd":64
* elif feat_name == SHAPE:
* return lex.shape
* elif feat_name == PREFIX: # <<<<<<<<<<<<<<
* return lex.prefix
* elif feat_name == SUFFIX:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":65
* return lex.shape
* elif feat_name == PREFIX:
* return lex.prefix # <<<<<<<<<<<<<<
* elif feat_name == SUFFIX:
* return lex.suffix
*/
__pyx_r = __pyx_v_lex->prefix;
goto __pyx_L0;
/* "lexeme.pxd":64
* elif feat_name == SHAPE:
* return lex.shape
* elif feat_name == PREFIX: # <<<<<<<<<<<<<<
* return lex.prefix
* elif feat_name == SUFFIX:
*/
}
/* "lexeme.pxd":66
* elif feat_name == PREFIX:
* return lex.prefix
* elif feat_name == SUFFIX: # <<<<<<<<<<<<<<
* return lex.suffix
* elif feat_name == LENGTH:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":67
* return lex.prefix
* elif feat_name == SUFFIX:
* return lex.suffix # <<<<<<<<<<<<<<
* elif feat_name == LENGTH:
* return lex.length
*/
__pyx_r = __pyx_v_lex->suffix;
goto __pyx_L0;
/* "lexeme.pxd":66
* elif feat_name == PREFIX:
* return lex.prefix
* elif feat_name == SUFFIX: # <<<<<<<<<<<<<<
* return lex.suffix
* elif feat_name == LENGTH:
*/
}
/* "lexeme.pxd":68
* elif feat_name == SUFFIX:
* return lex.suffix
* elif feat_name == LENGTH: # <<<<<<<<<<<<<<
* return lex.length
* elif feat_name == CLUSTER:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":69
* return lex.suffix
* elif feat_name == LENGTH:
* return lex.length # <<<<<<<<<<<<<<
* elif feat_name == CLUSTER:
* return lex.cluster
*/
__pyx_r = __pyx_v_lex->length;
goto __pyx_L0;
/* "lexeme.pxd":68
* elif feat_name == SUFFIX:
* return lex.suffix
* elif feat_name == LENGTH: # <<<<<<<<<<<<<<
* return lex.length
* elif feat_name == CLUSTER:
*/
}
/* "lexeme.pxd":70
* elif feat_name == LENGTH:
* return lex.length
* elif feat_name == CLUSTER: # <<<<<<<<<<<<<<
* return lex.cluster
* elif feat_name == LANG:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_CLUSTER) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":71
* return lex.length
* elif feat_name == CLUSTER:
* return lex.cluster # <<<<<<<<<<<<<<
* elif feat_name == LANG:
* return lex.lang
*/
__pyx_r = __pyx_v_lex->cluster;
goto __pyx_L0;
/* "lexeme.pxd":70
* elif feat_name == LENGTH:
* return lex.length
* elif feat_name == CLUSTER: # <<<<<<<<<<<<<<
* return lex.cluster
* elif feat_name == LANG:
*/
}
/* "lexeme.pxd":72
* elif feat_name == CLUSTER:
* return lex.cluster
* elif feat_name == LANG: # <<<<<<<<<<<<<<
* return lex.lang
* else:
*/
__pyx_t_1 = ((__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":73
* return lex.cluster
* elif feat_name == LANG:
* return lex.lang # <<<<<<<<<<<<<<
* else:
* return 0
*/
__pyx_r = __pyx_v_lex->lang;
goto __pyx_L0;
/* "lexeme.pxd":72
* elif feat_name == CLUSTER:
* return lex.cluster
* elif feat_name == LANG: # <<<<<<<<<<<<<<
* return lex.lang
* else:
*/
}
/* "lexeme.pxd":75
* return lex.lang
* else:
* return 0 # <<<<<<<<<<<<<<
*
* @staticmethod
*/
/*else*/ {
__pyx_r = 0;
goto __pyx_L0;
}
/* "lexeme.pxd":48
*
* @staticmethod
* cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil: # <<<<<<<<<<<<<<
* if feat_name < (sizeof(flags_t) * 8):
* if Lexeme.c_check_flag(lex, feat_name):
*/
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* "lexeme.pxd":78
*
* @staticmethod
* cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) nogil: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if lexeme.flags & (one << flag_id):
*/
static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) {
__pyx_t_5spacy_8typedefs_flags_t __pyx_v_one;
int __pyx_r;
int __pyx_t_1;
/* "lexeme.pxd":79
* @staticmethod
* cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) nogil:
* cdef flags_t one = 1 # <<<<<<<<<<<<<<
* if lexeme.flags & (one << flag_id):
* return True
*/
__pyx_v_one = 1;
/* "lexeme.pxd":80
* cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) nogil:
* cdef flags_t one = 1
* if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":81
* cdef flags_t one = 1
* if lexeme.flags & (one << flag_id):
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
__pyx_r = 1;
goto __pyx_L0;
/* "lexeme.pxd":80
* cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) nogil:
* cdef flags_t one = 1
* if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<<
* return True
* else:
*/
}
/* "lexeme.pxd":83
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* @staticmethod
*/
/*else*/ {
__pyx_r = 0;
goto __pyx_L0;
}
/* "lexeme.pxd":78
*
* @staticmethod
* cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) nogil: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if lexeme.flags & (one << flag_id):
*/
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* "lexeme.pxd":86
*
* @staticmethod
* cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) nogil: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if value:
*/
static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) {
__pyx_t_5spacy_8typedefs_flags_t __pyx_v_one;
int __pyx_r;
int __pyx_t_1;
/* "lexeme.pxd":87
* @staticmethod
* cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) nogil:
* cdef flags_t one = 1 # <<<<<<<<<<<<<<
* if value:
* lex.flags |= one << flag_id
*/
__pyx_v_one = 1;
/* "lexeme.pxd":88
* cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) nogil:
* cdef flags_t one = 1
* if value: # <<<<<<<<<<<<<<
* lex.flags |= one << flag_id
* else:
*/
__pyx_t_1 = (__pyx_v_value != 0);
if (__pyx_t_1) {
/* "lexeme.pxd":89
* cdef flags_t one = 1
* if value:
* lex.flags |= one << flag_id # <<<<<<<<<<<<<<
* else:
* lex.flags &= ~(one << flag_id)
*/
__pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id));
/* "lexeme.pxd":88
* cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) nogil:
* cdef flags_t one = 1
* if value: # <<<<<<<<<<<<<<
* lex.flags |= one << flag_id
* else:
*/
goto __pyx_L3;
}
/* "lexeme.pxd":91
* lex.flags |= one << flag_id
* else:
* lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<<
*/
/*else*/ {
__pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id)));
}
__pyx_L3:;
/* "lexeme.pxd":86
*
* @staticmethod
* cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) nogil: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if value:
*/
/* function exit code */
__pyx_r = 0;
return __pyx_r;
}
static struct __pyx_vtabstruct_5spacy_10morphology_Morphology __pyx_vtable_5spacy_10morphology_Morphology;
static PyObject *__pyx_tp_new_5spacy_10morphology_Morphology(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5spacy_10morphology_Morphology *p;
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
p = ((struct __pyx_obj_5spacy_10morphology_Morphology *)o);
p->__pyx_vtab = __pyx_vtabptr_5spacy_10morphology_Morphology;
p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None);
p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None);
p->lemmatizer = Py_None; Py_INCREF(Py_None);
p->tag_map = Py_None; Py_INCREF(Py_None);
p->n_tags = Py_None; Py_INCREF(Py_None);
p->reverse_index = Py_None; Py_INCREF(Py_None);
p->tag_names = Py_None; Py_INCREF(Py_None);
p->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMapArray *)Py_None); Py_INCREF(Py_None);
return o;
}
static void __pyx_tp_dealloc_5spacy_10morphology_Morphology(PyObject *o) {
struct __pyx_obj_5spacy_10morphology_Morphology *p = (struct __pyx_obj_5spacy_10morphology_Morphology *)o;
#if PY_VERSION_HEX >= 0x030400a1
if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
PyObject_GC_UnTrack(o);
Py_CLEAR(p->mem);
Py_CLEAR(p->strings);
Py_CLEAR(p->lemmatizer);
Py_CLEAR(p->tag_map);
Py_CLEAR(p->n_tags);
Py_CLEAR(p->reverse_index);
Py_CLEAR(p->tag_names);
Py_CLEAR(p->_cache);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_5spacy_10morphology_Morphology(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_5spacy_10morphology_Morphology *p = (struct __pyx_obj_5spacy_10morphology_Morphology *)o;
if (p->mem) {
e = (*v)(((PyObject*)p->mem), a); if (e) return e;
}
if (p->strings) {
e = (*v)(((PyObject*)p->strings), a); if (e) return e;
}
if (p->lemmatizer) {
e = (*v)(p->lemmatizer, a); if (e) return e;
}
if (p->tag_map) {
e = (*v)(p->tag_map, a); if (e) return e;
}
if (p->n_tags) {
e = (*v)(p->n_tags, a); if (e) return e;
}
if (p->reverse_index) {
e = (*v)(p->reverse_index, a); if (e) return e;
}
if (p->tag_names) {
e = (*v)(p->tag_names, a); if (e) return e;
}
if (p->_cache) {
e = (*v)(((PyObject*)p->_cache), a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_5spacy_10morphology_Morphology(PyObject *o) {
PyObject* tmp;
struct __pyx_obj_5spacy_10morphology_Morphology *p = (struct __pyx_obj_5spacy_10morphology_Morphology *)o;
tmp = ((PyObject*)p->mem);
p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->strings);
p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->lemmatizer);
p->lemmatizer = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->tag_map);
p->tag_map = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->n_tags);
p->n_tags = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->reverse_index);
p->reverse_index = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->tag_names);
p->tag_names = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_cache);
p->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMapArray *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_mem(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_3mem_1__get__(o);
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_strings(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_7strings_1__get__(o);
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_lemmatizer(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_1__get__(o);
}
static int __pyx_setprop_5spacy_10morphology_10Morphology_lemmatizer(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_3__set__(o, v);
}
else {
return __pyx_pw_5spacy_10morphology_10Morphology_10lemmatizer_5__del__(o);
}
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_tag_map(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_7tag_map_1__get__(o);
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_n_tags(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_1__get__(o);
}
static int __pyx_setprop_5spacy_10morphology_10Morphology_n_tags(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_3__set__(o, v);
}
else {
return __pyx_pw_5spacy_10morphology_10Morphology_6n_tags_5__del__(o);
}
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_reverse_index(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_1__get__(o);
}
static int __pyx_setprop_5spacy_10morphology_10Morphology_reverse_index(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_3__set__(o, v);
}
else {
return __pyx_pw_5spacy_10morphology_10Morphology_13reverse_index_5__del__(o);
}
}
static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_tag_names(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_1__get__(o);
}
static int __pyx_setprop_5spacy_10morphology_10Morphology_tag_names(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_3__set__(o, v);
}
else {
return __pyx_pw_5spacy_10morphology_10Morphology_9tag_names_5__del__(o);
}
}
static PyMethodDef __pyx_methods_5spacy_10morphology_Morphology[] = {
{"__reduce__", (PyCFunction)__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__, METH_NOARGS, 0},
{"add_special_case", (PyCFunction)__pyx_pw_5spacy_10morphology_10Morphology_5add_special_case, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_4add_special_case},
{"load_morph_exceptions", (PyCFunction)__pyx_pw_5spacy_10morphology_10Morphology_7load_morph_exceptions, METH_O, 0},
{"lemmatize", (PyCFunction)__pyx_pw_5spacy_10morphology_10Morphology_9lemmatize, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_5spacy_10morphology_Morphology[] = {
{(char *)"mem", __pyx_getprop_5spacy_10morphology_10Morphology_mem, 0, 0, 0},
{(char *)"strings", __pyx_getprop_5spacy_10morphology_10Morphology_strings, 0, 0, 0},
{(char *)"lemmatizer", __pyx_getprop_5spacy_10morphology_10Morphology_lemmatizer, __pyx_setprop_5spacy_10morphology_10Morphology_lemmatizer, 0, 0},
{(char *)"tag_map", __pyx_getprop_5spacy_10morphology_10Morphology_tag_map, 0, 0, 0},
{(char *)"n_tags", __pyx_getprop_5spacy_10morphology_10Morphology_n_tags, __pyx_setprop_5spacy_10morphology_10Morphology_n_tags, 0, 0},
{(char *)"reverse_index", __pyx_getprop_5spacy_10morphology_10Morphology_reverse_index, __pyx_setprop_5spacy_10morphology_10Morphology_reverse_index, 0, 0},
{(char *)"tag_names", __pyx_getprop_5spacy_10morphology_10Morphology_tag_names, __pyx_setprop_5spacy_10morphology_10Morphology_tag_names, 0, 0},
{0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_type_5spacy_10morphology_Morphology = {
PyVarObject_HEAD_INIT(0, 0)
"spacy.morphology.Morphology", /*tp_name*/
sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_5spacy_10morphology_Morphology, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5spacy_10morphology_Morphology, /*tp_traverse*/
__pyx_tp_clear_5spacy_10morphology_Morphology, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5spacy_10morphology_Morphology, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_5spacy_10morphology_Morphology, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
__pyx_pw_5spacy_10morphology_10Morphology_1__init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5spacy_10morphology_Morphology, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
#if PY_VERSION_HEX < 0x03020000
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
#else
PyModuleDef_HEAD_INIT,
#endif
"morphology",
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_u_Abbr_yes, __pyx_k_Abbr_yes, sizeof(__pyx_k_Abbr_yes), 0, 1, 0, 0},
{&__pyx_kp_u_AdpType_circ, __pyx_k_AdpType_circ, sizeof(__pyx_k_AdpType_circ), 0, 1, 0, 0},
{&__pyx_kp_u_AdpType_comprep, __pyx_k_AdpType_comprep, sizeof(__pyx_k_AdpType_comprep), 0, 1, 0, 0},
{&__pyx_kp_u_AdpType_post, __pyx_k_AdpType_post, sizeof(__pyx_k_AdpType_post), 0, 1, 0, 0},
{&__pyx_kp_u_AdpType_prep, __pyx_k_AdpType_prep, sizeof(__pyx_k_AdpType_prep), 0, 1, 0, 0},
{&__pyx_kp_u_AdpType_voc, __pyx_k_AdpType_voc, sizeof(__pyx_k_AdpType_voc), 0, 1, 0, 0},
{&__pyx_n_u_AdvType_adadj, __pyx_k_AdvType_adadj, sizeof(__pyx_k_AdvType_adadj), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_cau, __pyx_k_AdvType_cau, sizeof(__pyx_k_AdvType_cau), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_deg, __pyx_k_AdvType_deg, sizeof(__pyx_k_AdvType_deg), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_ex, __pyx_k_AdvType_ex, sizeof(__pyx_k_AdvType_ex), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_loc, __pyx_k_AdvType_loc, sizeof(__pyx_k_AdvType_loc), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_man, __pyx_k_AdvType_man, sizeof(__pyx_k_AdvType_man), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_mod, __pyx_k_AdvType_mod, sizeof(__pyx_k_AdvType_mod), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_sta, __pyx_k_AdvType_sta, sizeof(__pyx_k_AdvType_sta), 0, 1, 0, 1},
{&__pyx_n_u_AdvType_tim, __pyx_k_AdvType_tim, sizeof(__pyx_k_AdvType_tim), 0, 1, 0, 1},
{&__pyx_n_u_Animacy_anim, __pyx_k_Animacy_anim, sizeof(__pyx_k_Animacy_anim), 0, 1, 0, 1},
{&__pyx_n_u_Animacy_inam, __pyx_k_Animacy_inam, sizeof(__pyx_k_Animacy_inam), 0, 1, 0, 1},
{&__pyx_n_u_Aspect_freq, __pyx_k_Aspect_freq, sizeof(__pyx_k_Aspect_freq), 0, 1, 0, 1},
{&__pyx_n_u_Aspect_imp, __pyx_k_Aspect_imp, sizeof(__pyx_k_Aspect_imp), 0, 1, 0, 1},
{&__pyx_n_u_Aspect_mod, __pyx_k_Aspect_mod, sizeof(__pyx_k_Aspect_mod), 0, 1, 0, 1},
{&__pyx_n_u_Aspect_none, __pyx_k_Aspect_none, sizeof(__pyx_k_Aspect_none), 0, 1, 0, 1},
{&__pyx_n_u_Aspect_perf, __pyx_k_Aspect_perf, sizeof(__pyx_k_Aspect_perf), 0, 1, 0, 1},
{&__pyx_n_u_Case_abe, __pyx_k_Case_abe, sizeof(__pyx_k_Case_abe), 0, 1, 0, 1},
{&__pyx_n_u_Case_abl, __pyx_k_Case_abl, sizeof(__pyx_k_Case_abl), 0, 1, 0, 1},
{&__pyx_n_u_Case_abs, __pyx_k_Case_abs, sizeof(__pyx_k_Case_abs), 0, 1, 0, 1},
{&__pyx_n_u_Case_acc, __pyx_k_Case_acc, sizeof(__pyx_k_Case_acc), 0, 1, 0, 1},
{&__pyx_n_u_Case_ade, __pyx_k_Case_ade, sizeof(__pyx_k_Case_ade), 0, 1, 0, 1},
{&__pyx_n_u_Case_all, __pyx_k_Case_all, sizeof(__pyx_k_Case_all), 0, 1, 0, 1},
{&__pyx_n_u_Case_cau, __pyx_k_Case_cau, sizeof(__pyx_k_Case_cau), 0, 1, 0, 1},
{&__pyx_n_u_Case_com, __pyx_k_Case_com, sizeof(__pyx_k_Case_com), 0, 1, 0, 1},
{&__pyx_n_u_Case_dat, __pyx_k_Case_dat, sizeof(__pyx_k_Case_dat), 0, 1, 0, 1},
{&__pyx_n_u_Case_del, __pyx_k_Case_del, sizeof(__pyx_k_Case_del), 0, 1, 0, 1},
{&__pyx_n_u_Case_dis, __pyx_k_Case_dis, sizeof(__pyx_k_Case_dis), 0, 1, 0, 1},
{&__pyx_n_u_Case_ela, __pyx_k_Case_ela, sizeof(__pyx_k_Case_ela), 0, 1, 0, 1},
{&__pyx_n_u_Case_ess, __pyx_k_Case_ess, sizeof(__pyx_k_Case_ess), 0, 1, 0, 1},
{&__pyx_n_u_Case_gen, __pyx_k_Case_gen, sizeof(__pyx_k_Case_gen), 0, 1, 0, 1},
{&__pyx_n_u_Case_ill, __pyx_k_Case_ill, sizeof(__pyx_k_Case_ill), 0, 1, 0, 1},
{&__pyx_n_u_Case_ine, __pyx_k_Case_ine, sizeof(__pyx_k_Case_ine), 0, 1, 0, 1},
{&__pyx_n_u_Case_ins, __pyx_k_Case_ins, sizeof(__pyx_k_Case_ins), 0, 1, 0, 1},
{&__pyx_n_u_Case_lat, __pyx_k_Case_lat, sizeof(__pyx_k_Case_lat), 0, 1, 0, 1},
{&__pyx_n_u_Case_loc, __pyx_k_Case_loc, sizeof(__pyx_k_Case_loc), 0, 1, 0, 1},
{&__pyx_n_u_Case_nom, __pyx_k_Case_nom, sizeof(__pyx_k_Case_nom), 0, 1, 0, 1},
{&__pyx_n_u_Case_par, __pyx_k_Case_par, sizeof(__pyx_k_Case_par), 0, 1, 0, 1},
{&__pyx_n_u_Case_sub, __pyx_k_Case_sub, sizeof(__pyx_k_Case_sub), 0, 1, 0, 1},
{&__pyx_n_u_Case_sup, __pyx_k_Case_sup, sizeof(__pyx_k_Case_sup), 0, 1, 0, 1},
{&__pyx_n_u_Case_tem, __pyx_k_Case_tem, sizeof(__pyx_k_Case_tem), 0, 1, 0, 1},
{&__pyx_n_u_Case_ter, __pyx_k_Case_ter, sizeof(__pyx_k_Case_ter), 0, 1, 0, 1},
{&__pyx_n_u_Case_tra, __pyx_k_Case_tra, sizeof(__pyx_k_Case_tra), 0, 1, 0, 1},
{&__pyx_n_u_Case_voc, __pyx_k_Case_voc, sizeof(__pyx_k_Case_voc), 0, 1, 0, 1},
{&__pyx_kp_u_Conflicting_morphology_exception, __pyx_k_Conflicting_morphology_exception, sizeof(__pyx_k_Conflicting_morphology_exception), 0, 1, 0, 0},
{&__pyx_kp_u_ConjType_comp, __pyx_k_ConjType_comp, sizeof(__pyx_k_ConjType_comp), 0, 1, 0, 0},
{&__pyx_kp_u_ConjType_oper, __pyx_k_ConjType_oper, sizeof(__pyx_k_ConjType_oper), 0, 1, 0, 0},
{&__pyx_kp_u_Connegative_yes, __pyx_k_Connegative_yes, sizeof(__pyx_k_Connegative_yes), 0, 1, 0, 0},
{&__pyx_n_u_Definite_cons, __pyx_k_Definite_cons, sizeof(__pyx_k_Definite_cons), 0, 1, 0, 1},
{&__pyx_n_u_Definite_def, __pyx_k_Definite_def, sizeof(__pyx_k_Definite_def), 0, 1, 0, 1},
{&__pyx_n_u_Definite_ind, __pyx_k_Definite_ind, sizeof(__pyx_k_Definite_ind), 0, 1, 0, 1},
{&__pyx_n_u_Definite_red, __pyx_k_Definite_red, sizeof(__pyx_k_Definite_red), 0, 1, 0, 1},
{&__pyx_n_u_Definite_two, __pyx_k_Definite_two, sizeof(__pyx_k_Definite_two), 0, 1, 0, 1},
{&__pyx_n_u_Degree_abs, __pyx_k_Degree_abs, sizeof(__pyx_k_Degree_abs), 0, 1, 0, 1},
{&__pyx_n_u_Degree_cmp, __pyx_k_Degree_cmp, sizeof(__pyx_k_Degree_cmp), 0, 1, 0, 1},
{&__pyx_n_u_Degree_com, __pyx_k_Degree_com, sizeof(__pyx_k_Degree_com), 0, 1, 0, 1},
{&__pyx_n_u_Degree_comp, __pyx_k_Degree_comp, sizeof(__pyx_k_Degree_comp), 0, 1, 0, 1},
{&__pyx_kp_u_Degree_dim, __pyx_k_Degree_dim, sizeof(__pyx_k_Degree_dim), 0, 1, 0, 0},
{&__pyx_n_u_Degree_none, __pyx_k_Degree_none, sizeof(__pyx_k_Degree_none), 0, 1, 0, 1},
{&__pyx_n_u_Degree_pos, __pyx_k_Degree_pos, sizeof(__pyx_k_Degree_pos), 0, 1, 0, 1},
{&__pyx_n_u_Degree_sup, __pyx_k_Degree_sup, sizeof(__pyx_k_Degree_sup), 0, 1, 0, 1},
{&__pyx_kp_u_Derivation_inen, __pyx_k_Derivation_inen, sizeof(__pyx_k_Derivation_inen), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_ja, __pyx_k_Derivation_ja, sizeof(__pyx_k_Derivation_ja), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_lainen, __pyx_k_Derivation_lainen, sizeof(__pyx_k_Derivation_lainen), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_minen, __pyx_k_Derivation_minen, sizeof(__pyx_k_Derivation_minen), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_sti, __pyx_k_Derivation_sti, sizeof(__pyx_k_Derivation_sti), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_ton, __pyx_k_Derivation_ton, sizeof(__pyx_k_Derivation_ton), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_ttaa, __pyx_k_Derivation_ttaa, sizeof(__pyx_k_Derivation_ttaa), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_ttain, __pyx_k_Derivation_ttain, sizeof(__pyx_k_Derivation_ttain), 0, 1, 0, 0},
{&__pyx_kp_u_Derivation_vs, __pyx_k_Derivation_vs, sizeof(__pyx_k_Derivation_vs), 0, 1, 0, 0},
{&__pyx_kp_s_E_Twilight_Projects_Python_Spacy, __pyx_k_E_Twilight_Projects_Python_Spacy, sizeof(__pyx_k_E_Twilight_Projects_Python_Spacy), 0, 0, 1, 0},
{&__pyx_kp_u_Echo_ech, __pyx_k_Echo_ech, sizeof(__pyx_k_Echo_ech), 0, 1, 0, 0},
{&__pyx_kp_u_Echo_rdp, __pyx_k_Echo_rdp, sizeof(__pyx_k_Echo_rdp), 0, 1, 0, 0},
{&__pyx_kp_u_Foreign_foreign, __pyx_k_Foreign_foreign, sizeof(__pyx_k_Foreign_foreign), 0, 1, 0, 0},
{&__pyx_kp_u_Foreign_fscript, __pyx_k_Foreign_fscript, sizeof(__pyx_k_Foreign_fscript), 0, 1, 0, 0},
{&__pyx_kp_u_Foreign_tscript, __pyx_k_Foreign_tscript, sizeof(__pyx_k_Foreign_tscript), 0, 1, 0, 0},
{&__pyx_kp_u_Foreign_yes, __pyx_k_Foreign_yes, sizeof(__pyx_k_Foreign_yes), 0, 1, 0, 0},
{&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
{&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
{&__pyx_n_u_Gender_com, __pyx_k_Gender_com, sizeof(__pyx_k_Gender_com), 0, 1, 0, 1},
{&__pyx_kp_u_Gender_dat_fem, __pyx_k_Gender_dat_fem, sizeof(__pyx_k_Gender_dat_fem), 0, 1, 0, 0},
{&__pyx_kp_u_Gender_dat_masc, __pyx_k_Gender_dat_masc, sizeof(__pyx_k_Gender_dat_masc), 0, 1, 0, 0},
{&__pyx_kp_u_Gender_erg_fem, __pyx_k_Gender_erg_fem, sizeof(__pyx_k_Gender_erg_fem), 0, 1, 0, 0},
{&__pyx_kp_u_Gender_erg_masc, __pyx_k_Gender_erg_masc, sizeof(__pyx_k_Gender_erg_masc), 0, 1, 0, 0},
{&__pyx_n_u_Gender_fem, __pyx_k_Gender_fem, sizeof(__pyx_k_Gender_fem), 0, 1, 0, 1},
{&__pyx_n_u_Gender_masc, __pyx_k_Gender_masc, sizeof(__pyx_k_Gender_masc), 0, 1, 0, 1},
{&__pyx_n_u_Gender_neut, __pyx_k_Gender_neut, sizeof(__pyx_k_Gender_neut), 0, 1, 0, 1},
{&__pyx_kp_u_Gender_psor_fem, __pyx_k_Gender_psor_fem, sizeof(__pyx_k_Gender_psor_fem), 0, 1, 0, 0},
{&__pyx_kp_u_Gender_psor_masc, __pyx_k_Gender_psor_masc, sizeof(__pyx_k_Gender_psor_masc), 0, 1, 0, 0},
{&__pyx_kp_u_Gender_psor_neut, __pyx_k_Gender_psor_neut, sizeof(__pyx_k_Gender_psor_neut), 0, 1, 0, 0},
{&__pyx_kp_u_Hyph_yes, __pyx_k_Hyph_yes, sizeof(__pyx_k_Hyph_yes), 0, 1, 0, 0},
{&__pyx_n_s_IDS, __pyx_k_IDS, sizeof(__pyx_k_IDS), 0, 0, 1, 1},
{&__pyx_kp_u_InfForm_one, __pyx_k_InfForm_one, sizeof(__pyx_k_InfForm_one), 0, 1, 0, 0},
{&__pyx_kp_u_InfForm_three, __pyx_k_InfForm_three, sizeof(__pyx_k_InfForm_three), 0, 1, 0, 0},
{&__pyx_kp_u_InfForm_two, __pyx_k_InfForm_two, sizeof(__pyx_k_InfForm_two), 0, 1, 0, 0},
{&__pyx_n_s_LEMMA, __pyx_k_LEMMA, sizeof(__pyx_k_LEMMA), 0, 0, 1, 1},
{&__pyx_n_u_Mood_cnd, __pyx_k_Mood_cnd, sizeof(__pyx_k_Mood_cnd), 0, 1, 0, 1},
{&__pyx_n_u_Mood_imp, __pyx_k_Mood_imp, sizeof(__pyx_k_Mood_imp), 0, 1, 0, 1},
{&__pyx_n_u_Mood_ind, __pyx_k_Mood_ind, sizeof(__pyx_k_Mood_ind), 0, 1, 0, 1},
{&__pyx_n_u_Mood_n, __pyx_k_Mood_n, sizeof(__pyx_k_Mood_n), 0, 1, 0, 1},
{&__pyx_n_u_Mood_opt, __pyx_k_Mood_opt, sizeof(__pyx_k_Mood_opt), 0, 1, 0, 1},
{&__pyx_n_u_Mood_pot, __pyx_k_Mood_pot, sizeof(__pyx_k_Mood_pot), 0, 1, 0, 1},
{&__pyx_n_u_Mood_sub, __pyx_k_Mood_sub, sizeof(__pyx_k_Mood_sub), 0, 1, 0, 1},
{&__pyx_n_s_NAMES, __pyx_k_NAMES, sizeof(__pyx_k_NAMES), 0, 0, 1, 1},
{&__pyx_kp_u_NameType_com, __pyx_k_NameType_com, sizeof(__pyx_k_NameType_com), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_geo, __pyx_k_NameType_geo, sizeof(__pyx_k_NameType_geo), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_giv, __pyx_k_NameType_giv, sizeof(__pyx_k_NameType_giv), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_nat, __pyx_k_NameType_nat, sizeof(__pyx_k_NameType_nat), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_oth, __pyx_k_NameType_oth, sizeof(__pyx_k_NameType_oth), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_pro, __pyx_k_NameType_pro, sizeof(__pyx_k_NameType_pro), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_prs, __pyx_k_NameType_prs, sizeof(__pyx_k_NameType_prs), 0, 1, 0, 0},
{&__pyx_kp_u_NameType_sur, __pyx_k_NameType_sur, sizeof(__pyx_k_NameType_sur), 0, 1, 0, 0},
{&__pyx_n_u_Negative_neg, __pyx_k_Negative_neg, sizeof(__pyx_k_Negative_neg), 0, 1, 0, 1},
{&__pyx_n_u_Negative_pos, __pyx_k_Negative_pos, sizeof(__pyx_k_Negative_pos), 0, 1, 0, 1},
{&__pyx_n_u_Negative_yes, __pyx_k_Negative_yes, sizeof(__pyx_k_Negative_yes), 0, 1, 0, 1},
{&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
{&__pyx_kp_u_NounType_class, __pyx_k_NounType_class, sizeof(__pyx_k_NounType_class), 0, 1, 0, 0},
{&__pyx_kp_u_NounType_com, __pyx_k_NounType_com, sizeof(__pyx_k_NounType_com), 0, 1, 0, 0},
{&__pyx_kp_u_NounType_prop, __pyx_k_NounType_prop, sizeof(__pyx_k_NounType_prop), 0, 1, 0, 0},
{&__pyx_kp_u_NumForm_digit, __pyx_k_NumForm_digit, sizeof(__pyx_k_NumForm_digit), 0, 1, 0, 0},
{&__pyx_kp_u_NumForm_roman, __pyx_k_NumForm_roman, sizeof(__pyx_k_NumForm_roman), 0, 1, 0, 0},
{&__pyx_kp_u_NumForm_word, __pyx_k_NumForm_word, sizeof(__pyx_k_NumForm_word), 0, 1, 0, 0},
{&__pyx_n_u_NumType_card, __pyx_k_NumType_card, sizeof(__pyx_k_NumType_card), 0, 1, 0, 1},
{&__pyx_n_u_NumType_dist, __pyx_k_NumType_dist, sizeof(__pyx_k_NumType_dist), 0, 1, 0, 1},
{&__pyx_n_u_NumType_frac, __pyx_k_NumType_frac, sizeof(__pyx_k_NumType_frac), 0, 1, 0, 1},
{&__pyx_n_u_NumType_gen, __pyx_k_NumType_gen, sizeof(__pyx_k_NumType_gen), 0, 1, 0, 1},
{&__pyx_n_u_NumType_mult, __pyx_k_NumType_mult, sizeof(__pyx_k_NumType_mult), 0, 1, 0, 1},
{&__pyx_n_u_NumType_none, __pyx_k_NumType_none, sizeof(__pyx_k_NumType_none), 0, 1, 0, 1},
{&__pyx_n_u_NumType_ord, __pyx_k_NumType_ord, sizeof(__pyx_k_NumType_ord), 0, 1, 0, 1},
{&__pyx_n_u_NumType_sets, __pyx_k_NumType_sets, sizeof(__pyx_k_NumType_sets), 0, 1, 0, 1},
{&__pyx_kp_u_NumValue_one, __pyx_k_NumValue_one, sizeof(__pyx_k_NumValue_one), 0, 1, 0, 0},
{&__pyx_kp_u_NumValue_three, __pyx_k_NumValue_three, sizeof(__pyx_k_NumValue_three), 0, 1, 0, 0},
{&__pyx_kp_u_NumValue_two, __pyx_k_NumValue_two, sizeof(__pyx_k_NumValue_two), 0, 1, 0, 0},
{&__pyx_kp_u_Number_abs_plur, __pyx_k_Number_abs_plur, sizeof(__pyx_k_Number_abs_plur), 0, 1, 0, 0},
{&__pyx_kp_u_Number_abs_sing, __pyx_k_Number_abs_sing, sizeof(__pyx_k_Number_abs_sing), 0, 1, 0, 0},
{&__pyx_n_u_Number_com, __pyx_k_Number_com, sizeof(__pyx_k_Number_com), 0, 1, 0, 1},
{&__pyx_kp_u_Number_count, __pyx_k_Number_count, sizeof(__pyx_k_Number_count), 0, 1, 0, 0},
{&__pyx_kp_u_Number_dat_plur, __pyx_k_Number_dat_plur, sizeof(__pyx_k_Number_dat_plur), 0, 1, 0, 0},
{&__pyx_kp_u_Number_dat_sing, __pyx_k_Number_dat_sing, sizeof(__pyx_k_Number_dat_sing), 0, 1, 0, 0},
{&__pyx_n_u_Number_dual, __pyx_k_Number_dual, sizeof(__pyx_k_Number_dual), 0, 1, 0, 1},
{&__pyx_kp_u_Number_erg_plur, __pyx_k_Number_erg_plur, sizeof(__pyx_k_Number_erg_plur), 0, 1, 0, 0},
{&__pyx_kp_u_Number_erg_sing, __pyx_k_Number_erg_sing, sizeof(__pyx_k_Number_erg_sing), 0, 1, 0, 0},
{&__pyx_n_u_Number_none, __pyx_k_Number_none, sizeof(__pyx_k_Number_none), 0, 1, 0, 1},
{&__pyx_n_u_Number_plur, __pyx_k_Number_plur, sizeof(__pyx_k_Number_plur), 0, 1, 0, 1},
{&__pyx_kp_u_Number_psee_plur, __pyx_k_Number_psee_plur, sizeof(__pyx_k_Number_psee_plur), 0, 1, 0, 0},
{&__pyx_kp_u_Number_psee_sing, __pyx_k_Number_psee_sing, sizeof(__pyx_k_Number_psee_sing), 0, 1, 0, 0},
{&__pyx_kp_u_Number_psor_plur, __pyx_k_Number_psor_plur, sizeof(__pyx_k_Number_psor_plur), 0, 1, 0, 0},
{&__pyx_kp_u_Number_psor_sing, __pyx_k_Number_psor_sing, sizeof(__pyx_k_Number_psor_sing), 0, 1, 0, 0},
{&__pyx_kp_u_Number_ptan, __pyx_k_Number_ptan, sizeof(__pyx_k_Number_ptan), 0, 1, 0, 0},
{&__pyx_n_u_Number_sing, __pyx_k_Number_sing, sizeof(__pyx_k_Number_sing), 0, 1, 0, 1},
{&__pyx_n_s_POS_IDS, __pyx_k_POS_IDS, sizeof(__pyx_k_POS_IDS), 0, 0, 1, 1},
{&__pyx_kp_u_PartForm_agt, __pyx_k_PartForm_agt, sizeof(__pyx_k_PartForm_agt), 0, 1, 0, 0},
{&__pyx_kp_u_PartForm_neg, __pyx_k_PartForm_neg, sizeof(__pyx_k_PartForm_neg), 0, 1, 0, 0},
{&__pyx_kp_u_PartForm_past, __pyx_k_PartForm_past, sizeof(__pyx_k_PartForm_past), 0, 1, 0, 0},
{&__pyx_kp_u_PartForm_pres, __pyx_k_PartForm_pres, sizeof(__pyx_k_PartForm_pres), 0, 1, 0, 0},
{&__pyx_kp_u_PartType_emp, __pyx_k_PartType_emp, sizeof(__pyx_k_PartType_emp), 0, 1, 0, 0},
{&__pyx_kp_u_PartType_inf, __pyx_k_PartType_inf, sizeof(__pyx_k_PartType_inf), 0, 1, 0, 0},
{&__pyx_kp_u_PartType_mod, __pyx_k_PartType_mod, sizeof(__pyx_k_PartType_mod), 0, 1, 0, 0},
{&__pyx_kp_u_PartType_res, __pyx_k_PartType_res, sizeof(__pyx_k_PartType_res), 0, 1, 0, 0},
{&__pyx_kp_u_PartType_vbp, __pyx_k_PartType_vbp, sizeof(__pyx_k_PartType_vbp), 0, 1, 0, 0},
{&__pyx_kp_u_Person_abs_one, __pyx_k_Person_abs_one, sizeof(__pyx_k_Person_abs_one), 0, 1, 0, 0},
{&__pyx_kp_u_Person_abs_three, __pyx_k_Person_abs_three, sizeof(__pyx_k_Person_abs_three), 0, 1, 0, 0},
{&__pyx_kp_u_Person_abs_two, __pyx_k_Person_abs_two, sizeof(__pyx_k_Person_abs_two), 0, 1, 0, 0},
{&__pyx_kp_u_Person_dat_one, __pyx_k_Person_dat_one, sizeof(__pyx_k_Person_dat_one), 0, 1, 0, 0},
{&__pyx_kp_u_Person_dat_three, __pyx_k_Person_dat_three, sizeof(__pyx_k_Person_dat_three), 0, 1, 0, 0},
{&__pyx_kp_u_Person_dat_two, __pyx_k_Person_dat_two, sizeof(__pyx_k_Person_dat_two), 0, 1, 0, 0},
{&__pyx_kp_u_Person_erg_one, __pyx_k_Person_erg_one, sizeof(__pyx_k_Person_erg_one), 0, 1, 0, 0},
{&__pyx_kp_u_Person_erg_three, __pyx_k_Person_erg_three, sizeof(__pyx_k_Person_erg_three), 0, 1, 0, 0},
{&__pyx_kp_u_Person_erg_two, __pyx_k_Person_erg_two, sizeof(__pyx_k_Person_erg_two), 0, 1, 0, 0},
{&__pyx_n_u_Person_none, __pyx_k_Person_none, sizeof(__pyx_k_Person_none), 0, 1, 0, 1},
{&__pyx_n_u_Person_one, __pyx_k_Person_one, sizeof(__pyx_k_Person_one), 0, 1, 0, 1},
{&__pyx_kp_u_Person_psor_one, __pyx_k_Person_psor_one, sizeof(__pyx_k_Person_psor_one), 0, 1, 0, 0},
{&__pyx_kp_u_Person_psor_three, __pyx_k_Person_psor_three, sizeof(__pyx_k_Person_psor_three), 0, 1, 0, 0},
{&__pyx_kp_u_Person_psor_two, __pyx_k_Person_psor_two, sizeof(__pyx_k_Person_psor_two), 0, 1, 0, 0},
{&__pyx_n_u_Person_three, __pyx_k_Person_three, sizeof(__pyx_k_Person_three), 0, 1, 0, 1},
{&__pyx_n_u_Person_two, __pyx_k_Person_two, sizeof(__pyx_k_Person_two), 0, 1, 0, 1},
{&__pyx_n_u_Polarity_neg, __pyx_k_Polarity_neg, sizeof(__pyx_k_Polarity_neg), 0, 1, 0, 1},
{&__pyx_n_u_Polarity_pos, __pyx_k_Polarity_pos, sizeof(__pyx_k_Polarity_pos), 0, 1, 0, 1},
{&__pyx_kp_u_Polite_abs_inf, __pyx_k_Polite_abs_inf, sizeof(__pyx_k_Polite_abs_inf), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_abs_pol, __pyx_k_Polite_abs_pol, sizeof(__pyx_k_Polite_abs_pol), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_dat_inf, __pyx_k_Polite_dat_inf, sizeof(__pyx_k_Polite_dat_inf), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_dat_pol, __pyx_k_Polite_dat_pol, sizeof(__pyx_k_Polite_dat_pol), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_erg_inf, __pyx_k_Polite_erg_inf, sizeof(__pyx_k_Polite_erg_inf), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_erg_pol, __pyx_k_Polite_erg_pol, sizeof(__pyx_k_Polite_erg_pol), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_inf, __pyx_k_Polite_inf, sizeof(__pyx_k_Polite_inf), 0, 1, 0, 0},
{&__pyx_kp_u_Polite_pol, __pyx_k_Polite_pol, sizeof(__pyx_k_Polite_pol), 0, 1, 0, 0},
{&__pyx_n_u_Poss_yes, __pyx_k_Poss_yes, sizeof(__pyx_k_Poss_yes), 0, 1, 0, 1},
{&__pyx_kp_u_Prefix_yes, __pyx_k_Prefix_yes, sizeof(__pyx_k_Prefix_yes), 0, 1, 0, 0},
{&__pyx_kp_u_PrepCase_npr, __pyx_k_PrepCase_npr, sizeof(__pyx_k_PrepCase_npr), 0, 1, 0, 0},
{&__pyx_kp_u_PrepCase_pre, __pyx_k_PrepCase_pre, sizeof(__pyx_k_PrepCase_pre), 0, 1, 0, 0},
{&__pyx_n_u_PronType_advPart, __pyx_k_PronType_advPart, sizeof(__pyx_k_PronType_advPart), 0, 1, 0, 1},
{&__pyx_n_u_PronType_art, __pyx_k_PronType_art, sizeof(__pyx_k_PronType_art), 0, 1, 0, 1},
{&__pyx_n_u_PronType_clit, __pyx_k_PronType_clit, sizeof(__pyx_k_PronType_clit), 0, 1, 0, 1},
{&__pyx_n_u_PronType_default, __pyx_k_PronType_default, sizeof(__pyx_k_PronType_default), 0, 1, 0, 1},
{&__pyx_n_u_PronType_dem, __pyx_k_PronType_dem, sizeof(__pyx_k_PronType_dem), 0, 1, 0, 1},
{&__pyx_kp_u_PronType_exc, __pyx_k_PronType_exc, sizeof(__pyx_k_PronType_exc), 0, 1, 0, 0},
{&__pyx_n_u_PronType_ind, __pyx_k_PronType_ind, sizeof(__pyx_k_PronType_ind), 0, 1, 0, 1},
{&__pyx_n_u_PronType_int, __pyx_k_PronType_int, sizeof(__pyx_k_PronType_int), 0, 1, 0, 1},
{&__pyx_n_u_PronType_neg, __pyx_k_PronType_neg, sizeof(__pyx_k_PronType_neg), 0, 1, 0, 1},
{&__pyx_n_u_PronType_prs, __pyx_k_PronType_prs, sizeof(__pyx_k_PronType_prs), 0, 1, 0, 1},
{&__pyx_n_u_PronType_rcp, __pyx_k_PronType_rcp, sizeof(__pyx_k_PronType_rcp), 0, 1, 0, 1},
{&__pyx_n_u_PronType_rel, __pyx_k_PronType_rel, sizeof(__pyx_k_PronType_rel), 0, 1, 0, 1},
{&__pyx_n_u_PronType_tot, __pyx_k_PronType_tot, sizeof(__pyx_k_PronType_tot), 0, 1, 0, 1},
{&__pyx_kp_u_PunctSide_fin, __pyx_k_PunctSide_fin, sizeof(__pyx_k_PunctSide_fin), 0, 1, 0, 0},
{&__pyx_kp_u_PunctSide_ini, __pyx_k_PunctSide_ini, sizeof(__pyx_k_PunctSide_ini), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_brck, __pyx_k_PunctType_brck, sizeof(__pyx_k_PunctType_brck), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_colo, __pyx_k_PunctType_colo, sizeof(__pyx_k_PunctType_colo), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_comm, __pyx_k_PunctType_comm, sizeof(__pyx_k_PunctType_comm), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_dash, __pyx_k_PunctType_dash, sizeof(__pyx_k_PunctType_dash), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_excl, __pyx_k_PunctType_excl, sizeof(__pyx_k_PunctType_excl), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_peri, __pyx_k_PunctType_peri, sizeof(__pyx_k_PunctType_peri), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_qest, __pyx_k_PunctType_qest, sizeof(__pyx_k_PunctType_qest), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_quot, __pyx_k_PunctType_quot, sizeof(__pyx_k_PunctType_quot), 0, 1, 0, 0},
{&__pyx_kp_u_PunctType_semi, __pyx_k_PunctType_semi, sizeof(__pyx_k_PunctType_semi), 0, 1, 0, 0},
{&__pyx_n_u_Reflex_yes, __pyx_k_Reflex_yes, sizeof(__pyx_k_Reflex_yes), 0, 1, 0, 1},
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
{&__pyx_n_u_SP, __pyx_k_SP, sizeof(__pyx_k_SP), 0, 1, 0, 1},
{&__pyx_kp_u_StyleVariant_styleBound, __pyx_k_StyleVariant_styleBound, sizeof(__pyx_k_StyleVariant_styleBound), 0, 1, 0, 0},
{&__pyx_kp_u_StyleVariant_styleShort, __pyx_k_StyleVariant_styleShort, sizeof(__pyx_k_StyleVariant_styleShort), 0, 1, 0, 0},
{&__pyx_kp_u_Style_arch, __pyx_k_Style_arch, sizeof(__pyx_k_Style_arch), 0, 1, 0, 0},
{&__pyx_kp_u_Style_coll, __pyx_k_Style_coll, sizeof(__pyx_k_Style_coll), 0, 1, 0, 0},
{&__pyx_kp_u_Style_derg, __pyx_k_Style_derg, sizeof(__pyx_k_Style_derg), 0, 1, 0, 0},
{&__pyx_kp_u_Style_expr, __pyx_k_Style_expr, sizeof(__pyx_k_Style_expr), 0, 1, 0, 0},
{&__pyx_kp_u_Style_norm, __pyx_k_Style_norm, sizeof(__pyx_k_Style_norm), 0, 1, 0, 0},
{&__pyx_kp_u_Style_poet, __pyx_k_Style_poet, sizeof(__pyx_k_Style_poet), 0, 1, 0, 0},
{&__pyx_kp_u_Style_rare, __pyx_k_Style_rare, sizeof(__pyx_k_Style_rare), 0, 1, 0, 0},
{&__pyx_kp_u_Style_sing, __pyx_k_Style_sing, sizeof(__pyx_k_Style_sing), 0, 1, 0, 0},
{&__pyx_kp_u_Style_vrnc, __pyx_k_Style_vrnc, sizeof(__pyx_k_Style_vrnc), 0, 1, 0, 0},
{&__pyx_kp_u_Style_vulg, __pyx_k_Style_vulg, sizeof(__pyx_k_Style_vulg), 0, 1, 0, 0},
{&__pyx_kp_u_Style_yes, __pyx_k_Style_yes, sizeof(__pyx_k_Style_yes), 0, 1, 0, 0},
{&__pyx_n_u_Tense_fut, __pyx_k_Tense_fut, sizeof(__pyx_k_Tense_fut), 0, 1, 0, 1},
{&__pyx_n_u_Tense_imp, __pyx_k_Tense_imp, sizeof(__pyx_k_Tense_imp), 0, 1, 0, 1},
{&__pyx_n_u_Tense_past, __pyx_k_Tense_past, sizeof(__pyx_k_Tense_past), 0, 1, 0, 1},
{&__pyx_n_u_Tense_pres, __pyx_k_Tense_pres, sizeof(__pyx_k_Tense_pres), 0, 1, 0, 1},
{&__pyx_kp_u_Unknown_tag_ID_s, __pyx_k_Unknown_tag_ID_s, sizeof(__pyx_k_Unknown_tag_ID_s), 0, 1, 0, 0},
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
{&__pyx_n_u_VerbForm_conv, __pyx_k_VerbForm_conv, sizeof(__pyx_k_VerbForm_conv), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_fin, __pyx_k_VerbForm_fin, sizeof(__pyx_k_VerbForm_fin), 0, 1, 0, 1},
{&__pyx_kp_u_VerbForm_gdv, __pyx_k_VerbForm_gdv, sizeof(__pyx_k_VerbForm_gdv), 0, 1, 0, 0},
{&__pyx_n_u_VerbForm_ger, __pyx_k_VerbForm_ger, sizeof(__pyx_k_VerbForm_ger), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_inf, __pyx_k_VerbForm_inf, sizeof(__pyx_k_VerbForm_inf), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_none, __pyx_k_VerbForm_none, sizeof(__pyx_k_VerbForm_none), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_part, __pyx_k_VerbForm_part, sizeof(__pyx_k_VerbForm_part), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_partFut, __pyx_k_VerbForm_partFut, sizeof(__pyx_k_VerbForm_partFut), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_partPast, __pyx_k_VerbForm_partPast, sizeof(__pyx_k_VerbForm_partPast), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_partPres, __pyx_k_VerbForm_partPres, sizeof(__pyx_k_VerbForm_partPres), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_sup, __pyx_k_VerbForm_sup, sizeof(__pyx_k_VerbForm_sup), 0, 1, 0, 1},
{&__pyx_n_u_VerbForm_trans, __pyx_k_VerbForm_trans, sizeof(__pyx_k_VerbForm_trans), 0, 1, 0, 1},
{&__pyx_kp_u_VerbType_aux, __pyx_k_VerbType_aux, sizeof(__pyx_k_VerbType_aux), 0, 1, 0, 0},
{&__pyx_kp_u_VerbType_cop, __pyx_k_VerbType_cop, sizeof(__pyx_k_VerbType_cop), 0, 1, 0, 0},
{&__pyx_kp_u_VerbType_light, __pyx_k_VerbType_light, sizeof(__pyx_k_VerbType_light), 0, 1, 0, 0},
{&__pyx_kp_u_VerbType_mod, __pyx_k_VerbType_mod, sizeof(__pyx_k_VerbType_mod), 0, 1, 0, 0},
{&__pyx_n_u_Voice_act, __pyx_k_Voice_act, sizeof(__pyx_k_Voice_act), 0, 1, 0, 1},
{&__pyx_n_u_Voice_cau, __pyx_k_Voice_cau, sizeof(__pyx_k_Voice_cau), 0, 1, 0, 1},
{&__pyx_kp_u_Voice_int, __pyx_k_Voice_int, sizeof(__pyx_k_Voice_int), 0, 1, 0, 0},
{&__pyx_kp_u_Voice_mid, __pyx_k_Voice_mid, sizeof(__pyx_k_Voice_mid), 0, 1, 0, 0},
{&__pyx_n_u_Voice_pass, __pyx_k_Voice_pass, sizeof(__pyx_k_Voice_pass), 0, 1, 0, 1},
{&__pyx_n_s_add_special_case, __pyx_k_add_special_case, sizeof(__pyx_k_add_special_case), 0, 0, 1, 1},
{&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
{&__pyx_n_s_do_deprecated, __pyx_k_do_deprecated, sizeof(__pyx_k_do_deprecated), 0, 0, 1, 1},
{&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
{&__pyx_n_s_force, __pyx_k_force, sizeof(__pyx_k_force), 0, 0, 1, 1},
{&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
{&__pyx_n_s_intify_attrs, __pyx_k_intify_attrs, sizeof(__pyx_k_intify_attrs), 0, 0, 1, 1},
{&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
{&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
{&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
{&__pyx_n_s_lambda, __pyx_k_lambda, sizeof(__pyx_k_lambda), 0, 0, 1, 1},
{&__pyx_n_s_lemmatize, __pyx_k_lemmatize, sizeof(__pyx_k_lemmatize), 0, 0, 1, 1},
{&__pyx_n_s_lemmatizer, __pyx_k_lemmatizer, sizeof(__pyx_k_lemmatizer), 0, 0, 1, 1},
{&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
{&__pyx_n_s_morphology, __pyx_k_morphology, sizeof(__pyx_k_morphology), 0, 0, 1, 1},
{&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
{&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
{&__pyx_n_s_normalize_props, __pyx_k_normalize_props, sizeof(__pyx_k_normalize_props), 0, 0, 1, 1},
{&__pyx_n_s_orth, __pyx_k_orth, sizeof(__pyx_k_orth), 0, 0, 1, 1},
{&__pyx_n_s_orth_str, __pyx_k_orth_str, sizeof(__pyx_k_orth_str), 0, 0, 1, 1},
{&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
{&__pyx_n_s_parts_of_speech, __pyx_k_parts_of_speech, sizeof(__pyx_k_parts_of_speech), 0, 0, 1, 1},
{&__pyx_n_u_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 1, 0, 1},
{&__pyx_n_s_props, __pyx_k_props, sizeof(__pyx_k_props), 0, 0, 1, 1},
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
{&__pyx_n_s_sorted, __pyx_k_sorted, sizeof(__pyx_k_sorted), 0, 0, 1, 1},
{&__pyx_n_s_spacy_morphology, __pyx_k_spacy_morphology, sizeof(__pyx_k_spacy_morphology), 0, 0, 1, 1},
{&__pyx_n_s_string_store, __pyx_k_string_store, sizeof(__pyx_k_string_store), 0, 0, 1, 1},
{&__pyx_n_s_tag_map, __pyx_k_tag_map, sizeof(__pyx_k_tag_map), 0, 0, 1, 1},
{&__pyx_n_s_tag_str, __pyx_k_tag_str, sizeof(__pyx_k_tag_str), 0, 0, 1, 1},
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
{&__pyx_n_s_univ_pos, __pyx_k_univ_pos, sizeof(__pyx_k_univ_pos), 0, 0, 1, 1},
{&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
{&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
{&__pyx_n_u_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 1, 0, 1},
{&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":218
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
*/
__pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple_);
__Pyx_GIVEREF(__pyx_tuple_);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":222
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
*
* info.buf = PyArray_DATA(self)
*/
__pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__2);
__Pyx_GIVEREF(__pyx_tuple__2);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":259
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B"
*/
__pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__3);
__Pyx_GIVEREF(__pyx_tuple__3);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":799
*
* if (end - f) - <int>(new_offset - offset[0]) < 15:
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
*
* if ((child.byteorder == c'>' and little_endian) or
*/
__pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__4);
__Pyx_GIVEREF(__pyx_tuple__4);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":803
* if ((child.byteorder == c'>' and little_endian) or
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* # One could encode it in the format string and have Cython
* # complain instead, BUT: < and > in format strings also imply
*/
__pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__5);
__Pyx_GIVEREF(__pyx_tuple__5);
/* "c:\python\lib\site-packages\Cython\Includes\numpy\__init__.pxd":823
* t = child.type_num
* if end - f < 5:
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
*
* # Until ticket #99 is fixed, use integers to avoid warnings
*/
__pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__6);
__Pyx_GIVEREF(__pyx_tuple__6);
/* "spacy\morphology.pyx":14
*
*
* def _normalize_props(props): # <<<<<<<<<<<<<<
* """
* Transform deprecated string keys to correct names.
*/
__pyx_tuple__7 = PyTuple_Pack(4, __pyx_n_s_props, __pyx_n_s_out, __pyx_n_s_key, __pyx_n_s_value); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__7);
__Pyx_GIVEREF(__pyx_tuple__7);
__pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_E_Twilight_Projects_Python_Spacy, __pyx_n_s_normalize_props, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_InitGlobals(void) {
__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initmorphology(void); /*proto*/
PyMODINIT_FUNC initmorphology(void)
#else
PyMODINIT_FUNC PyInit_morphology(void); /*proto*/
PyMODINIT_FUNC PyInit_morphology(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
Py_ssize_t __pyx_t_8;
PyObject *(*__pyx_t_9)(PyObject *);
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *(*__pyx_t_12)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_morphology(void)", 0);
if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Coroutine_USED
if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_StopAsyncIteration_USED
if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4("morphology", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_d);
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
if (__pyx_module_is_main_spacy__morphology) {
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if PY_MAJOR_VERSION >= 3
{
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!PyDict_GetItemString(modules, "spacy.morphology")) {
if (unlikely(PyDict_SetItemString(modules, "spacy.morphology", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
#endif
/*--- Builtin init code ---*/
if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
__pyx_vtabptr_5spacy_10morphology_Morphology = &__pyx_vtable_5spacy_10morphology_Morphology;
__pyx_vtable_5spacy_10morphology_Morphology.assign_tag = (int (*)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_TokenC *, PyObject *))__pyx_f_5spacy_10morphology_10Morphology_assign_tag;
__pyx_vtable_5spacy_10morphology_Morphology.assign_tag_id = (int (*)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_TokenC *, int))__pyx_f_5spacy_10morphology_10Morphology_assign_tag_id;
__pyx_vtable_5spacy_10morphology_Morphology.assign_feature = (int (*)(struct __pyx_obj_5spacy_10morphology_Morphology *, uint64_t *, enum __pyx_t_5spacy_10morphology_univ_morph_t, int))__pyx_f_5spacy_10morphology_10Morphology_assign_feature;
if (PyType_Ready(&__pyx_type_5spacy_10morphology_Morphology) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_5spacy_10morphology_Morphology.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_5spacy_10morphology_Morphology.tp_dict, __pyx_vtabptr_5spacy_10morphology_Morphology) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Morphology", (PyObject *)&__pyx_type_5spacy_10morphology_Morphology) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5spacy_10morphology_Morphology = &__pyx_type_5spacy_10morphology_Morphology;
/*--- Type import code ---*/
__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType("cymem.cymem", "Pool", sizeof(struct __pyx_obj_5cymem_5cymem_Pool), 1); if (unlikely(!__pyx_ptype_5cymem_5cymem_Pool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_ptype_5cymem_5cymem_Pool->tp_dict); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType("cymem.cymem", "Address", sizeof(struct __pyx_obj_5cymem_5cymem_Address), 1); if (unlikely(!__pyx_ptype_5cymem_5cymem_Address)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType("preshed.maps", "PreshMap", sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), 1); if (unlikely(!__pyx_ptype_7preshed_4maps_PreshMap)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_ptype_7preshed_4maps_PreshMap->tp_dict); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType("preshed.maps", "PreshMapArray", sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), 1); if (unlikely(!__pyx_ptype_7preshed_4maps_PreshMapArray)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_ptype_7preshed_4maps_PreshMapArray->tp_dict); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType("spacy.strings", "StringStore", sizeof(struct __pyx_obj_5spacy_7strings_StringStore), 1); if (unlikely(!__pyx_ptype_5spacy_7strings_StringStore)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_ptype_5spacy_7strings_StringStore->tp_dict); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType("spacy.vocab", "Vocab", sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), 1); if (unlikely(!__pyx_ptype_5spacy_5vocab_Vocab)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_ptype_5spacy_5vocab_Vocab->tp_dict); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
#if CYTHON_COMPILING_IN_PYPY
sizeof(PyTypeObject),
#else
sizeof(PyHeapTypeObject),
#endif
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType("spacy.lexeme", "Lexeme", sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), 1); if (unlikely(!__pyx_ptype_5spacy_6lexeme_Lexeme)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_ptype_5spacy_6lexeme_Lexeme->tp_dict); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Variable import code ---*/
__pyx_t_1 = __Pyx_ImportModule("spacy.vocab"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_ImportVoidPtr(__pyx_t_1, "EMPTY_LEXEME", (void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, "struct __pyx_t_5spacy_7structs_LexemeC") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_2 = __Pyx_ImportModule("spacy.lexeme"); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_ImportVoidPtr(__pyx_t_2, "EMPTY_LEXEME", (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, "struct __pyx_t_5spacy_7structs_LexemeC") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*--- Function import code ---*/
__pyx_t_3 = __Pyx_ImportModule("murmurhash.mrmr"); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_ImportFunction(__pyx_t_3, "hash64", (void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, "uint64_t (void *, int, uint64_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/*--- Execution code ---*/
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/* "spacy\morphology.pyx":9
* from .parts_of_speech cimport ADJ, VERB, NOUN, PUNCT
* from .attrs cimport POS, IS_SPACE
* from .parts_of_speech import IDS as POS_IDS # <<<<<<<<<<<<<<
* from .lexeme cimport Lexeme
* from .attrs import LEMMA, intify_attrs
*/
__pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_n_s_IDS);
__Pyx_GIVEREF(__pyx_n_s_IDS);
PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_IDS);
__pyx_t_5 = __Pyx_Import(__pyx_n_s_parts_of_speech, __pyx_t_4, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_IDS); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_POS_IDS, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":11
* from .parts_of_speech import IDS as POS_IDS
* from .lexeme cimport Lexeme
* from .attrs import LEMMA, intify_attrs # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_n_s_LEMMA);
__Pyx_GIVEREF(__pyx_n_s_LEMMA);
PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_LEMMA);
__Pyx_INCREF(__pyx_n_s_intify_attrs);
__Pyx_GIVEREF(__pyx_n_s_intify_attrs);
PyList_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_intify_attrs);
__pyx_t_4 = __Pyx_Import(__pyx_n_s_attrs, __pyx_t_5, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_LEMMA); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_LEMMA, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_intify_attrs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_intify_attrs, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "spacy\morphology.pyx":14
*
*
* def _normalize_props(props): # <<<<<<<<<<<<<<
* """
* Transform deprecated string keys to correct names.
*/
__pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_5spacy_10morphology_1_normalize_props, NULL, __pyx_n_s_spacy_morphology); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalize_props, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "spacy\morphology.pyx":155
*
* IDS = {
* "Animacy_anim": Animacy_anim, # <<<<<<<<<<<<<<
* "Animacy_inam": Animacy_inam,
* "Aspect_freq": Aspect_freq,
*/
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Animacy_anim); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Animacy_anim, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":156
* IDS = {
* "Animacy_anim": Animacy_anim,
* "Animacy_inam": Animacy_inam, # <<<<<<<<<<<<<<
* "Aspect_freq": Aspect_freq,
* "Aspect_imp": Aspect_imp,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Animacy_inam); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Animacy_inam, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":157
* "Animacy_anim": Animacy_anim,
* "Animacy_inam": Animacy_inam,
* "Aspect_freq": Aspect_freq, # <<<<<<<<<<<<<<
* "Aspect_imp": Aspect_imp,
* "Aspect_mod": Aspect_mod,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_freq); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Aspect_freq, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":158
* "Animacy_inam": Animacy_inam,
* "Aspect_freq": Aspect_freq,
* "Aspect_imp": Aspect_imp, # <<<<<<<<<<<<<<
* "Aspect_mod": Aspect_mod,
* "Aspect_none": Aspect_none,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_imp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Aspect_imp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":159
* "Aspect_freq": Aspect_freq,
* "Aspect_imp": Aspect_imp,
* "Aspect_mod": Aspect_mod, # <<<<<<<<<<<<<<
* "Aspect_none": Aspect_none,
* "Aspect_perf": Aspect_perf,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_mod); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Aspect_mod, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":160
* "Aspect_imp": Aspect_imp,
* "Aspect_mod": Aspect_mod,
* "Aspect_none": Aspect_none, # <<<<<<<<<<<<<<
* "Aspect_perf": Aspect_perf,
* "Case_abe": Case_abe,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_none); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Aspect_none, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":161
* "Aspect_mod": Aspect_mod,
* "Aspect_none": Aspect_none,
* "Aspect_perf": Aspect_perf, # <<<<<<<<<<<<<<
* "Case_abe": Case_abe,
* "Case_abl": Case_abl,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_perf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Aspect_perf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":162
* "Aspect_none": Aspect_none,
* "Aspect_perf": Aspect_perf,
* "Case_abe": Case_abe, # <<<<<<<<<<<<<<
* "Case_abl": Case_abl,
* "Case_abs": Case_abs,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_abe); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_abe, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":163
* "Aspect_perf": Aspect_perf,
* "Case_abe": Case_abe,
* "Case_abl": Case_abl, # <<<<<<<<<<<<<<
* "Case_abs": Case_abs,
* "Case_acc": Case_acc,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_abl); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_abl, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":164
* "Case_abe": Case_abe,
* "Case_abl": Case_abl,
* "Case_abs": Case_abs, # <<<<<<<<<<<<<<
* "Case_acc": Case_acc,
* "Case_ade": Case_ade,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_abs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_abs, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":165
* "Case_abl": Case_abl,
* "Case_abs": Case_abs,
* "Case_acc": Case_acc, # <<<<<<<<<<<<<<
* "Case_ade": Case_ade,
* "Case_all": Case_all,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_acc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_acc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":166
* "Case_abs": Case_abs,
* "Case_acc": Case_acc,
* "Case_ade": Case_ade, # <<<<<<<<<<<<<<
* "Case_all": Case_all,
* "Case_cau": Case_cau,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ade); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ade, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":167
* "Case_acc": Case_acc,
* "Case_ade": Case_ade,
* "Case_all": Case_all, # <<<<<<<<<<<<<<
* "Case_cau": Case_cau,
* "Case_com": Case_com,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_all); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_all, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":168
* "Case_ade": Case_ade,
* "Case_all": Case_all,
* "Case_cau": Case_cau, # <<<<<<<<<<<<<<
* "Case_com": Case_com,
* "Case_dat": Case_dat,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_cau); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_cau, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":169
* "Case_all": Case_all,
* "Case_cau": Case_cau,
* "Case_com": Case_com, # <<<<<<<<<<<<<<
* "Case_dat": Case_dat,
* "Case_del": Case_del,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_com); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_com, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":170
* "Case_cau": Case_cau,
* "Case_com": Case_com,
* "Case_dat": Case_dat, # <<<<<<<<<<<<<<
* "Case_del": Case_del,
* "Case_dis": Case_dis,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_dat); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_dat, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":171
* "Case_com": Case_com,
* "Case_dat": Case_dat,
* "Case_del": Case_del, # <<<<<<<<<<<<<<
* "Case_dis": Case_dis,
* "Case_ela": Case_ela,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_del); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_del, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":172
* "Case_dat": Case_dat,
* "Case_del": Case_del,
* "Case_dis": Case_dis, # <<<<<<<<<<<<<<
* "Case_ela": Case_ela,
* "Case_ess": Case_ess,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_dis); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_dis, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":173
* "Case_del": Case_del,
* "Case_dis": Case_dis,
* "Case_ela": Case_ela, # <<<<<<<<<<<<<<
* "Case_ess": Case_ess,
* "Case_gen": Case_gen,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ela); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ela, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":174
* "Case_dis": Case_dis,
* "Case_ela": Case_ela,
* "Case_ess": Case_ess, # <<<<<<<<<<<<<<
* "Case_gen": Case_gen,
* "Case_ill": Case_ill,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ess); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ess, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":175
* "Case_ela": Case_ela,
* "Case_ess": Case_ess,
* "Case_gen": Case_gen, # <<<<<<<<<<<<<<
* "Case_ill": Case_ill,
* "Case_ine": Case_ine,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_gen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_gen, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":176
* "Case_ess": Case_ess,
* "Case_gen": Case_gen,
* "Case_ill": Case_ill, # <<<<<<<<<<<<<<
* "Case_ine": Case_ine,
* "Case_ins": Case_ins,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ill); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ill, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":177
* "Case_gen": Case_gen,
* "Case_ill": Case_ill,
* "Case_ine": Case_ine, # <<<<<<<<<<<<<<
* "Case_ins": Case_ins,
* "Case_loc": Case_loc,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ine); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ine, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":178
* "Case_ill": Case_ill,
* "Case_ine": Case_ine,
* "Case_ins": Case_ins, # <<<<<<<<<<<<<<
* "Case_loc": Case_loc,
* "Case_lat": Case_lat,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ins, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":179
* "Case_ine": Case_ine,
* "Case_ins": Case_ins,
* "Case_loc": Case_loc, # <<<<<<<<<<<<<<
* "Case_lat": Case_lat,
* "Case_nom": Case_nom,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_loc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_loc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":180
* "Case_ins": Case_ins,
* "Case_loc": Case_loc,
* "Case_lat": Case_lat, # <<<<<<<<<<<<<<
* "Case_nom": Case_nom,
* "Case_par": Case_par,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_lat); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_lat, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":181
* "Case_loc": Case_loc,
* "Case_lat": Case_lat,
* "Case_nom": Case_nom, # <<<<<<<<<<<<<<
* "Case_par": Case_par,
* "Case_sub": Case_sub,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_nom); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_nom, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":182
* "Case_lat": Case_lat,
* "Case_nom": Case_nom,
* "Case_par": Case_par, # <<<<<<<<<<<<<<
* "Case_sub": Case_sub,
* "Case_sup": Case_sup,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_par); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_par, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":183
* "Case_nom": Case_nom,
* "Case_par": Case_par,
* "Case_sub": Case_sub, # <<<<<<<<<<<<<<
* "Case_sup": Case_sup,
* "Case_tem": Case_tem,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_sub); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_sub, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":184
* "Case_par": Case_par,
* "Case_sub": Case_sub,
* "Case_sup": Case_sup, # <<<<<<<<<<<<<<
* "Case_tem": Case_tem,
* "Case_ter": Case_ter,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_sup); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_sup, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":185
* "Case_sub": Case_sub,
* "Case_sup": Case_sup,
* "Case_tem": Case_tem, # <<<<<<<<<<<<<<
* "Case_ter": Case_ter,
* "Case_tra": Case_tra,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_tem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_tem, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":186
* "Case_sup": Case_sup,
* "Case_tem": Case_tem,
* "Case_ter": Case_ter, # <<<<<<<<<<<<<<
* "Case_tra": Case_tra,
* "Case_voc": Case_voc,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_ter, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":187
* "Case_tem": Case_tem,
* "Case_ter": Case_ter,
* "Case_tra": Case_tra, # <<<<<<<<<<<<<<
* "Case_voc": Case_voc,
* "Definite_two": Definite_two,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_tra); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_tra, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":188
* "Case_ter": Case_ter,
* "Case_tra": Case_tra,
* "Case_voc": Case_voc, # <<<<<<<<<<<<<<
* "Definite_two": Definite_two,
* "Definite_def": Definite_def,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_voc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Case_voc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":189
* "Case_tra": Case_tra,
* "Case_voc": Case_voc,
* "Definite_two": Definite_two, # <<<<<<<<<<<<<<
* "Definite_def": Definite_def,
* "Definite_red": Definite_red,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Definite_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":190
* "Case_voc": Case_voc,
* "Definite_two": Definite_two,
* "Definite_def": Definite_def, # <<<<<<<<<<<<<<
* "Definite_red": Definite_red,
* "Definite_cons": Definite_cons, # U20
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_def); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Definite_def, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":191
* "Definite_two": Definite_two,
* "Definite_def": Definite_def,
* "Definite_red": Definite_red, # <<<<<<<<<<<<<<
* "Definite_cons": Definite_cons, # U20
* "Definite_ind": Definite_ind,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_red); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Definite_red, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":192
* "Definite_def": Definite_def,
* "Definite_red": Definite_red,
* "Definite_cons": Definite_cons, # U20 # <<<<<<<<<<<<<<
* "Definite_ind": Definite_ind,
* "Degree_cmp": Degree_cmp,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_cons); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Definite_cons, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":193
* "Definite_red": Definite_red,
* "Definite_cons": Definite_cons, # U20
* "Definite_ind": Definite_ind, # <<<<<<<<<<<<<<
* "Degree_cmp": Degree_cmp,
* "Degree_comp": Degree_comp,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Definite_ind, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":194
* "Definite_cons": Definite_cons, # U20
* "Definite_ind": Definite_ind,
* "Degree_cmp": Degree_cmp, # <<<<<<<<<<<<<<
* "Degree_comp": Degree_comp,
* "Degree_none": Degree_none,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_cmp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_cmp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":195
* "Definite_ind": Definite_ind,
* "Degree_cmp": Degree_cmp,
* "Degree_comp": Degree_comp, # <<<<<<<<<<<<<<
* "Degree_none": Degree_none,
* "Degree_pos": Degree_pos,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_comp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_comp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":196
* "Degree_cmp": Degree_cmp,
* "Degree_comp": Degree_comp,
* "Degree_none": Degree_none, # <<<<<<<<<<<<<<
* "Degree_pos": Degree_pos,
* "Degree_sup": Degree_sup,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_none); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_none, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":197
* "Degree_comp": Degree_comp,
* "Degree_none": Degree_none,
* "Degree_pos": Degree_pos, # <<<<<<<<<<<<<<
* "Degree_sup": Degree_sup,
* "Degree_abs": Degree_abs,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_pos, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":198
* "Degree_none": Degree_none,
* "Degree_pos": Degree_pos,
* "Degree_sup": Degree_sup, # <<<<<<<<<<<<<<
* "Degree_abs": Degree_abs,
* "Degree_com": Degree_com,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_sup); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_sup, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":199
* "Degree_pos": Degree_pos,
* "Degree_sup": Degree_sup,
* "Degree_abs": Degree_abs, # <<<<<<<<<<<<<<
* "Degree_com": Degree_com,
* "Degree_dim ": Degree_dim, # du
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_abs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_abs, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":200
* "Degree_sup": Degree_sup,
* "Degree_abs": Degree_abs,
* "Degree_com": Degree_com, # <<<<<<<<<<<<<<
* "Degree_dim ": Degree_dim, # du
* "Gender_com": Gender_com,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_com); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Degree_com, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":201
* "Degree_abs": Degree_abs,
* "Degree_com": Degree_com,
* "Degree_dim ": Degree_dim, # du # <<<<<<<<<<<<<<
* "Gender_com": Gender_com,
* "Gender_fem": Gender_fem,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_dim); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Degree_dim, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":202
* "Degree_com": Degree_com,
* "Degree_dim ": Degree_dim, # du
* "Gender_com": Gender_com, # <<<<<<<<<<<<<<
* "Gender_fem": Gender_fem,
* "Gender_masc": Gender_masc,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_com); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Gender_com, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":203
* "Degree_dim ": Degree_dim, # du
* "Gender_com": Gender_com,
* "Gender_fem": Gender_fem, # <<<<<<<<<<<<<<
* "Gender_masc": Gender_masc,
* "Gender_neut": Gender_neut,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_fem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Gender_fem, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":204
* "Gender_com": Gender_com,
* "Gender_fem": Gender_fem,
* "Gender_masc": Gender_masc, # <<<<<<<<<<<<<<
* "Gender_neut": Gender_neut,
* "Mood_cnd": Mood_cnd,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_masc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Gender_masc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":205
* "Gender_fem": Gender_fem,
* "Gender_masc": Gender_masc,
* "Gender_neut": Gender_neut, # <<<<<<<<<<<<<<
* "Mood_cnd": Mood_cnd,
* "Mood_imp": Mood_imp,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_neut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Gender_neut, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":206
* "Gender_masc": Gender_masc,
* "Gender_neut": Gender_neut,
* "Mood_cnd": Mood_cnd, # <<<<<<<<<<<<<<
* "Mood_imp": Mood_imp,
* "Mood_ind": Mood_ind,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_cnd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_cnd, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":207
* "Gender_neut": Gender_neut,
* "Mood_cnd": Mood_cnd,
* "Mood_imp": Mood_imp, # <<<<<<<<<<<<<<
* "Mood_ind": Mood_ind,
* "Mood_n": Mood_n,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_imp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_imp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":208
* "Mood_cnd": Mood_cnd,
* "Mood_imp": Mood_imp,
* "Mood_ind": Mood_ind, # <<<<<<<<<<<<<<
* "Mood_n": Mood_n,
* "Mood_pot": Mood_pot,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_ind, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":209
* "Mood_imp": Mood_imp,
* "Mood_ind": Mood_ind,
* "Mood_n": Mood_n, # <<<<<<<<<<<<<<
* "Mood_pot": Mood_pot,
* "Mood_sub": Mood_sub,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_n, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":210
* "Mood_ind": Mood_ind,
* "Mood_n": Mood_n,
* "Mood_pot": Mood_pot, # <<<<<<<<<<<<<<
* "Mood_sub": Mood_sub,
* "Mood_opt": Mood_opt,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_pot); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_pot, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":211
* "Mood_n": Mood_n,
* "Mood_pot": Mood_pot,
* "Mood_sub": Mood_sub, # <<<<<<<<<<<<<<
* "Mood_opt": Mood_opt,
* "Negative_neg": Negative_neg,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_sub); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_sub, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":212
* "Mood_pot": Mood_pot,
* "Mood_sub": Mood_sub,
* "Mood_opt": Mood_opt, # <<<<<<<<<<<<<<
* "Negative_neg": Negative_neg,
* "Negative_pos": Negative_pos,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_opt); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Mood_opt, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":213
* "Mood_sub": Mood_sub,
* "Mood_opt": Mood_opt,
* "Negative_neg": Negative_neg, # <<<<<<<<<<<<<<
* "Negative_pos": Negative_pos,
* "Negative_yes": Negative_yes,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Negative_neg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Negative_neg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":214
* "Mood_opt": Mood_opt,
* "Negative_neg": Negative_neg,
* "Negative_pos": Negative_pos, # <<<<<<<<<<<<<<
* "Negative_yes": Negative_yes,
* "Polarity_neg": Polarity_neg, # U20
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Negative_pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Negative_pos, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":215
* "Negative_neg": Negative_neg,
* "Negative_pos": Negative_pos,
* "Negative_yes": Negative_yes, # <<<<<<<<<<<<<<
* "Polarity_neg": Polarity_neg, # U20
* "Polarity_pos": Polarity_pos, # U20
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Negative_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Negative_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":216
* "Negative_pos": Negative_pos,
* "Negative_yes": Negative_yes,
* "Polarity_neg": Polarity_neg, # U20 # <<<<<<<<<<<<<<
* "Polarity_pos": Polarity_pos, # U20
* "Number_com": Number_com,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polarity_neg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Polarity_neg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":217
* "Negative_yes": Negative_yes,
* "Polarity_neg": Polarity_neg, # U20
* "Polarity_pos": Polarity_pos, # U20 # <<<<<<<<<<<<<<
* "Number_com": Number_com,
* "Number_dual": Number_dual,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polarity_pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Polarity_pos, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":218
* "Polarity_neg": Polarity_neg, # U20
* "Polarity_pos": Polarity_pos, # U20
* "Number_com": Number_com, # <<<<<<<<<<<<<<
* "Number_dual": Number_dual,
* "Number_none": Number_none,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_com); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Number_com, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":219
* "Polarity_pos": Polarity_pos, # U20
* "Number_com": Number_com,
* "Number_dual": Number_dual, # <<<<<<<<<<<<<<
* "Number_none": Number_none,
* "Number_plur": Number_plur,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_dual); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Number_dual, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":220
* "Number_com": Number_com,
* "Number_dual": Number_dual,
* "Number_none": Number_none, # <<<<<<<<<<<<<<
* "Number_plur": Number_plur,
* "Number_sing": Number_sing,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_none); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Number_none, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":221
* "Number_dual": Number_dual,
* "Number_none": Number_none,
* "Number_plur": Number_plur, # <<<<<<<<<<<<<<
* "Number_sing": Number_sing,
* "Number_ptan ": Number_ptan, # bg
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_plur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Number_plur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":222
* "Number_none": Number_none,
* "Number_plur": Number_plur,
* "Number_sing": Number_sing, # <<<<<<<<<<<<<<
* "Number_ptan ": Number_ptan, # bg
* "Number_count ": Number_count, # bg
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Number_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":223
* "Number_plur": Number_plur,
* "Number_sing": Number_sing,
* "Number_ptan ": Number_ptan, # bg # <<<<<<<<<<<<<<
* "Number_count ": Number_count, # bg
* "NumType_card": NumType_card,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_ptan); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_ptan, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":224
* "Number_sing": Number_sing,
* "Number_ptan ": Number_ptan, # bg
* "Number_count ": Number_count, # bg # <<<<<<<<<<<<<<
* "NumType_card": NumType_card,
* "NumType_dist": NumType_dist,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_count, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":225
* "Number_ptan ": Number_ptan, # bg
* "Number_count ": Number_count, # bg
* "NumType_card": NumType_card, # <<<<<<<<<<<<<<
* "NumType_dist": NumType_dist,
* "NumType_frac": NumType_frac,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_card); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_card, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":226
* "Number_count ": Number_count, # bg
* "NumType_card": NumType_card,
* "NumType_dist": NumType_dist, # <<<<<<<<<<<<<<
* "NumType_frac": NumType_frac,
* "NumType_gen": NumType_gen,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_dist); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_dist, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":227
* "NumType_card": NumType_card,
* "NumType_dist": NumType_dist,
* "NumType_frac": NumType_frac, # <<<<<<<<<<<<<<
* "NumType_gen": NumType_gen,
* "NumType_mult": NumType_mult,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_frac); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_frac, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":228
* "NumType_dist": NumType_dist,
* "NumType_frac": NumType_frac,
* "NumType_gen": NumType_gen, # <<<<<<<<<<<<<<
* "NumType_mult": NumType_mult,
* "NumType_none": NumType_none,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_gen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_gen, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":229
* "NumType_frac": NumType_frac,
* "NumType_gen": NumType_gen,
* "NumType_mult": NumType_mult, # <<<<<<<<<<<<<<
* "NumType_none": NumType_none,
* "NumType_ord": NumType_ord,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_mult); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_mult, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":230
* "NumType_gen": NumType_gen,
* "NumType_mult": NumType_mult,
* "NumType_none": NumType_none, # <<<<<<<<<<<<<<
* "NumType_ord": NumType_ord,
* "NumType_sets": NumType_sets,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_none); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_none, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":231
* "NumType_mult": NumType_mult,
* "NumType_none": NumType_none,
* "NumType_ord": NumType_ord, # <<<<<<<<<<<<<<
* "NumType_sets": NumType_sets,
* "Person_one": Person_one,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_ord); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_ord, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":232
* "NumType_none": NumType_none,
* "NumType_ord": NumType_ord,
* "NumType_sets": NumType_sets, # <<<<<<<<<<<<<<
* "Person_one": Person_one,
* "Person_two": Person_two,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_sets); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_NumType_sets, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":233
* "NumType_ord": NumType_ord,
* "NumType_sets": NumType_sets,
* "Person_one": Person_one, # <<<<<<<<<<<<<<
* "Person_two": Person_two,
* "Person_three": Person_three,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Person_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":234
* "NumType_sets": NumType_sets,
* "Person_one": Person_one,
* "Person_two": Person_two, # <<<<<<<<<<<<<<
* "Person_three": Person_three,
* "Person_none": Person_none,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Person_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":235
* "Person_one": Person_one,
* "Person_two": Person_two,
* "Person_three": Person_three, # <<<<<<<<<<<<<<
* "Person_none": Person_none,
* "Poss_yes": Poss_yes,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Person_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":236
* "Person_two": Person_two,
* "Person_three": Person_three,
* "Person_none": Person_none, # <<<<<<<<<<<<<<
* "Poss_yes": Poss_yes,
* "PronType_advPart": PronType_advPart,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_none); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Person_none, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":237
* "Person_three": Person_three,
* "Person_none": Person_none,
* "Poss_yes": Poss_yes, # <<<<<<<<<<<<<<
* "PronType_advPart": PronType_advPart,
* "PronType_art": PronType_art,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Poss_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Poss_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":238
* "Person_none": Person_none,
* "Poss_yes": Poss_yes,
* "PronType_advPart": PronType_advPart, # <<<<<<<<<<<<<<
* "PronType_art": PronType_art,
* "PronType_default": PronType_default,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_advPart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_advPart, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":239
* "Poss_yes": Poss_yes,
* "PronType_advPart": PronType_advPart,
* "PronType_art": PronType_art, # <<<<<<<<<<<<<<
* "PronType_default": PronType_default,
* "PronType_dem": PronType_dem,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_art); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_art, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":240
* "PronType_advPart": PronType_advPart,
* "PronType_art": PronType_art,
* "PronType_default": PronType_default, # <<<<<<<<<<<<<<
* "PronType_dem": PronType_dem,
* "PronType_ind": PronType_ind,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_default); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_default, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":241
* "PronType_art": PronType_art,
* "PronType_default": PronType_default,
* "PronType_dem": PronType_dem, # <<<<<<<<<<<<<<
* "PronType_ind": PronType_ind,
* "PronType_int": PronType_int,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_dem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_dem, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":242
* "PronType_default": PronType_default,
* "PronType_dem": PronType_dem,
* "PronType_ind": PronType_ind, # <<<<<<<<<<<<<<
* "PronType_int": PronType_int,
* "PronType_neg": PronType_neg,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_ind, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":243
* "PronType_dem": PronType_dem,
* "PronType_ind": PronType_ind,
* "PronType_int": PronType_int, # <<<<<<<<<<<<<<
* "PronType_neg": PronType_neg,
* "PronType_prs": PronType_prs,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_int, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":244
* "PronType_ind": PronType_ind,
* "PronType_int": PronType_int,
* "PronType_neg": PronType_neg, # <<<<<<<<<<<<<<
* "PronType_prs": PronType_prs,
* "PronType_rcp": PronType_rcp,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_neg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_neg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":245
* "PronType_int": PronType_int,
* "PronType_neg": PronType_neg,
* "PronType_prs": PronType_prs, # <<<<<<<<<<<<<<
* "PronType_rcp": PronType_rcp,
* "PronType_rel": PronType_rel,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_prs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_prs, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":246
* "PronType_neg": PronType_neg,
* "PronType_prs": PronType_prs,
* "PronType_rcp": PronType_rcp, # <<<<<<<<<<<<<<
* "PronType_rel": PronType_rel,
* "PronType_tot": PronType_tot,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_rcp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_rcp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":247
* "PronType_prs": PronType_prs,
* "PronType_rcp": PronType_rcp,
* "PronType_rel": PronType_rel, # <<<<<<<<<<<<<<
* "PronType_tot": PronType_tot,
* "PronType_clit": PronType_clit,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_rel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_rel, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":248
* "PronType_rcp": PronType_rcp,
* "PronType_rel": PronType_rel,
* "PronType_tot": PronType_tot, # <<<<<<<<<<<<<<
* "PronType_clit": PronType_clit,
* "PronType_exc ": PronType_exc, # es, ca, it, fa,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_tot); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_tot, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":249
* "PronType_rel": PronType_rel,
* "PronType_tot": PronType_tot,
* "PronType_clit": PronType_clit, # <<<<<<<<<<<<<<
* "PronType_exc ": PronType_exc, # es, ca, it, fa,
* "Reflex_yes": Reflex_yes,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_clit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_PronType_clit, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":250
* "PronType_tot": PronType_tot,
* "PronType_clit": PronType_clit,
* "PronType_exc ": PronType_exc, # es, ca, it, fa, # <<<<<<<<<<<<<<
* "Reflex_yes": Reflex_yes,
* "Tense_fut": Tense_fut,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_exc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PronType_exc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":251
* "PronType_clit": PronType_clit,
* "PronType_exc ": PronType_exc, # es, ca, it, fa,
* "Reflex_yes": Reflex_yes, # <<<<<<<<<<<<<<
* "Tense_fut": Tense_fut,
* "Tense_imp": Tense_imp,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Reflex_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Reflex_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":252
* "PronType_exc ": PronType_exc, # es, ca, it, fa,
* "Reflex_yes": Reflex_yes,
* "Tense_fut": Tense_fut, # <<<<<<<<<<<<<<
* "Tense_imp": Tense_imp,
* "Tense_past": Tense_past,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_fut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tense_fut, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":253
* "Reflex_yes": Reflex_yes,
* "Tense_fut": Tense_fut,
* "Tense_imp": Tense_imp, # <<<<<<<<<<<<<<
* "Tense_past": Tense_past,
* "Tense_pres": Tense_pres,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_imp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tense_imp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":254
* "Tense_fut": Tense_fut,
* "Tense_imp": Tense_imp,
* "Tense_past": Tense_past, # <<<<<<<<<<<<<<
* "Tense_pres": Tense_pres,
* "VerbForm_fin": VerbForm_fin,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_past); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tense_past, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":255
* "Tense_imp": Tense_imp,
* "Tense_past": Tense_past,
* "Tense_pres": Tense_pres, # <<<<<<<<<<<<<<
* "VerbForm_fin": VerbForm_fin,
* "VerbForm_ger": VerbForm_ger,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_pres); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tense_pres, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":256
* "Tense_past": Tense_past,
* "Tense_pres": Tense_pres,
* "VerbForm_fin": VerbForm_fin, # <<<<<<<<<<<<<<
* "VerbForm_ger": VerbForm_ger,
* "VerbForm_inf": VerbForm_inf,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_fin); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_fin, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":257
* "Tense_pres": Tense_pres,
* "VerbForm_fin": VerbForm_fin,
* "VerbForm_ger": VerbForm_ger, # <<<<<<<<<<<<<<
* "VerbForm_inf": VerbForm_inf,
* "VerbForm_none": VerbForm_none,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_ger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_ger, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":258
* "VerbForm_fin": VerbForm_fin,
* "VerbForm_ger": VerbForm_ger,
* "VerbForm_inf": VerbForm_inf, # <<<<<<<<<<<<<<
* "VerbForm_none": VerbForm_none,
* "VerbForm_part": VerbForm_part,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":259
* "VerbForm_ger": VerbForm_ger,
* "VerbForm_inf": VerbForm_inf,
* "VerbForm_none": VerbForm_none, # <<<<<<<<<<<<<<
* "VerbForm_part": VerbForm_part,
* "VerbForm_partFut": VerbForm_partFut,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_none); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_none, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":260
* "VerbForm_inf": VerbForm_inf,
* "VerbForm_none": VerbForm_none,
* "VerbForm_part": VerbForm_part, # <<<<<<<<<<<<<<
* "VerbForm_partFut": VerbForm_partFut,
* "VerbForm_partPast": VerbForm_partPast,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_part); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_part, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":261
* "VerbForm_none": VerbForm_none,
* "VerbForm_part": VerbForm_part,
* "VerbForm_partFut": VerbForm_partFut, # <<<<<<<<<<<<<<
* "VerbForm_partPast": VerbForm_partPast,
* "VerbForm_partPres": VerbForm_partPres,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_partFut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_partFut, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":262
* "VerbForm_part": VerbForm_part,
* "VerbForm_partFut": VerbForm_partFut,
* "VerbForm_partPast": VerbForm_partPast, # <<<<<<<<<<<<<<
* "VerbForm_partPres": VerbForm_partPres,
* "VerbForm_sup": VerbForm_sup,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_partPast); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_partPast, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":263
* "VerbForm_partFut": VerbForm_partFut,
* "VerbForm_partPast": VerbForm_partPast,
* "VerbForm_partPres": VerbForm_partPres, # <<<<<<<<<<<<<<
* "VerbForm_sup": VerbForm_sup,
* "VerbForm_trans": VerbForm_trans,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_partPres); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_partPres, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":264
* "VerbForm_partPast": VerbForm_partPast,
* "VerbForm_partPres": VerbForm_partPres,
* "VerbForm_sup": VerbForm_sup, # <<<<<<<<<<<<<<
* "VerbForm_trans": VerbForm_trans,
* "VerbForm_conv": VerbForm_conv, # U20
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_sup); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_sup, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":265
* "VerbForm_partPres": VerbForm_partPres,
* "VerbForm_sup": VerbForm_sup,
* "VerbForm_trans": VerbForm_trans, # <<<<<<<<<<<<<<
* "VerbForm_conv": VerbForm_conv, # U20
* "VerbForm_gdv ": VerbForm_gdv, # la,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_trans); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_trans, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":266
* "VerbForm_sup": VerbForm_sup,
* "VerbForm_trans": VerbForm_trans,
* "VerbForm_conv": VerbForm_conv, # U20 # <<<<<<<<<<<<<<
* "VerbForm_gdv ": VerbForm_gdv, # la,
* "Voice_act": Voice_act,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_conv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_VerbForm_conv, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":267
* "VerbForm_trans": VerbForm_trans,
* "VerbForm_conv": VerbForm_conv, # U20
* "VerbForm_gdv ": VerbForm_gdv, # la, # <<<<<<<<<<<<<<
* "Voice_act": Voice_act,
* "Voice_cau": Voice_cau,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_gdv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_VerbForm_gdv, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":268
* "VerbForm_conv": VerbForm_conv, # U20
* "VerbForm_gdv ": VerbForm_gdv, # la,
* "Voice_act": Voice_act, # <<<<<<<<<<<<<<
* "Voice_cau": Voice_cau,
* "Voice_pass": Voice_pass,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_act); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Voice_act, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":269
* "VerbForm_gdv ": VerbForm_gdv, # la,
* "Voice_act": Voice_act,
* "Voice_cau": Voice_cau, # <<<<<<<<<<<<<<
* "Voice_pass": Voice_pass,
* "Voice_mid ": Voice_mid, # gkc,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_cau); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Voice_cau, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":270
* "Voice_act": Voice_act,
* "Voice_cau": Voice_cau,
* "Voice_pass": Voice_pass, # <<<<<<<<<<<<<<
* "Voice_mid ": Voice_mid, # gkc,
* "Voice_int ": Voice_int, # hb,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_pass); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Voice_pass, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":271
* "Voice_cau": Voice_cau,
* "Voice_pass": Voice_pass,
* "Voice_mid ": Voice_mid, # gkc, # <<<<<<<<<<<<<<
* "Voice_int ": Voice_int, # hb,
* "Abbr_yes ": Abbr_yes, # cz, fi, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_mid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Voice_mid, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":272
* "Voice_pass": Voice_pass,
* "Voice_mid ": Voice_mid, # gkc,
* "Voice_int ": Voice_int, # hb, # <<<<<<<<<<<<<<
* "Abbr_yes ": Abbr_yes, # cz, fi, sl, U,
* "AdpType_prep ": AdpType_prep, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Voice_int, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":273
* "Voice_mid ": Voice_mid, # gkc,
* "Voice_int ": Voice_int, # hb,
* "Abbr_yes ": Abbr_yes, # cz, fi, sl, U, # <<<<<<<<<<<<<<
* "AdpType_prep ": AdpType_prep, # cz, U,
* "AdpType_post ": AdpType_post, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Abbr_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Abbr_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":274
* "Voice_int ": Voice_int, # hb,
* "Abbr_yes ": Abbr_yes, # cz, fi, sl, U,
* "AdpType_prep ": AdpType_prep, # cz, U, # <<<<<<<<<<<<<<
* "AdpType_post ": AdpType_post, # U,
* "AdpType_voc ": AdpType_voc, # cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_prep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_AdpType_prep, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":275
* "Abbr_yes ": Abbr_yes, # cz, fi, sl, U,
* "AdpType_prep ": AdpType_prep, # cz, U,
* "AdpType_post ": AdpType_post, # U, # <<<<<<<<<<<<<<
* "AdpType_voc ": AdpType_voc, # cz,
* "AdpType_comprep ": AdpType_comprep, # cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_post); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_AdpType_post, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":276
* "AdpType_prep ": AdpType_prep, # cz, U,
* "AdpType_post ": AdpType_post, # U,
* "AdpType_voc ": AdpType_voc, # cz, # <<<<<<<<<<<<<<
* "AdpType_comprep ": AdpType_comprep, # cz,
* "AdpType_circ ": AdpType_circ, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_voc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_AdpType_voc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":277
* "AdpType_post ": AdpType_post, # U,
* "AdpType_voc ": AdpType_voc, # cz,
* "AdpType_comprep ": AdpType_comprep, # cz, # <<<<<<<<<<<<<<
* "AdpType_circ ": AdpType_circ, # U,
* "AdvType_man": AdvType_man,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_comprep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_AdpType_comprep, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":278
* "AdpType_voc ": AdpType_voc, # cz,
* "AdpType_comprep ": AdpType_comprep, # cz,
* "AdpType_circ ": AdpType_circ, # U, # <<<<<<<<<<<<<<
* "AdvType_man": AdvType_man,
* "AdvType_loc": AdvType_loc,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_circ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_AdpType_circ, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":279
* "AdpType_comprep ": AdpType_comprep, # cz,
* "AdpType_circ ": AdpType_circ, # U,
* "AdvType_man": AdvType_man, # <<<<<<<<<<<<<<
* "AdvType_loc": AdvType_loc,
* "AdvType_tim": AdvType_tim,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_man); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_man, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":280
* "AdpType_circ ": AdpType_circ, # U,
* "AdvType_man": AdvType_man,
* "AdvType_loc": AdvType_loc, # <<<<<<<<<<<<<<
* "AdvType_tim": AdvType_tim,
* "AdvType_deg": AdvType_deg,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_loc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_loc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":281
* "AdvType_man": AdvType_man,
* "AdvType_loc": AdvType_loc,
* "AdvType_tim": AdvType_tim, # <<<<<<<<<<<<<<
* "AdvType_deg": AdvType_deg,
* "AdvType_cau": AdvType_cau,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_tim); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_tim, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":282
* "AdvType_loc": AdvType_loc,
* "AdvType_tim": AdvType_tim,
* "AdvType_deg": AdvType_deg, # <<<<<<<<<<<<<<
* "AdvType_cau": AdvType_cau,
* "AdvType_mod": AdvType_mod,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_deg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_deg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":283
* "AdvType_tim": AdvType_tim,
* "AdvType_deg": AdvType_deg,
* "AdvType_cau": AdvType_cau, # <<<<<<<<<<<<<<
* "AdvType_mod": AdvType_mod,
* "AdvType_sta": AdvType_sta,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_cau); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_cau, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":284
* "AdvType_deg": AdvType_deg,
* "AdvType_cau": AdvType_cau,
* "AdvType_mod": AdvType_mod, # <<<<<<<<<<<<<<
* "AdvType_sta": AdvType_sta,
* "AdvType_ex": AdvType_ex,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_mod); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_mod, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":285
* "AdvType_cau": AdvType_cau,
* "AdvType_mod": AdvType_mod,
* "AdvType_sta": AdvType_sta, # <<<<<<<<<<<<<<
* "AdvType_ex": AdvType_ex,
* "AdvType_adadj": AdvType_adadj,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_sta); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_sta, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":286
* "AdvType_mod": AdvType_mod,
* "AdvType_sta": AdvType_sta,
* "AdvType_ex": AdvType_ex, # <<<<<<<<<<<<<<
* "AdvType_adadj": AdvType_adadj,
* "ConjType_oper ": ConjType_oper, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_ex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_ex, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":287
* "AdvType_sta": AdvType_sta,
* "AdvType_ex": AdvType_ex,
* "AdvType_adadj": AdvType_adadj, # <<<<<<<<<<<<<<
* "ConjType_oper ": ConjType_oper, # cz, U,
* "ConjType_comp ": ConjType_comp, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_adadj); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_AdvType_adadj, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":288
* "AdvType_ex": AdvType_ex,
* "AdvType_adadj": AdvType_adadj,
* "ConjType_oper ": ConjType_oper, # cz, U, # <<<<<<<<<<<<<<
* "ConjType_comp ": ConjType_comp, # cz, U,
* "Connegative_yes ": Connegative_yes, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_ConjType_oper); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_ConjType_oper, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":289
* "AdvType_adadj": AdvType_adadj,
* "ConjType_oper ": ConjType_oper, # cz, U,
* "ConjType_comp ": ConjType_comp, # cz, U, # <<<<<<<<<<<<<<
* "Connegative_yes ": Connegative_yes, # fi,
* "Derivation_minen ": Derivation_minen, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_ConjType_comp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_ConjType_comp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":290
* "ConjType_oper ": ConjType_oper, # cz, U,
* "ConjType_comp ": ConjType_comp, # cz, U,
* "Connegative_yes ": Connegative_yes, # fi, # <<<<<<<<<<<<<<
* "Derivation_minen ": Derivation_minen, # fi,
* "Derivation_sti ": Derivation_sti, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Connegative_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Connegative_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":291
* "ConjType_comp ": ConjType_comp, # cz, U,
* "Connegative_yes ": Connegative_yes, # fi,
* "Derivation_minen ": Derivation_minen, # fi, # <<<<<<<<<<<<<<
* "Derivation_sti ": Derivation_sti, # fi,
* "Derivation_inen ": Derivation_inen, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_minen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_minen, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":292
* "Connegative_yes ": Connegative_yes, # fi,
* "Derivation_minen ": Derivation_minen, # fi,
* "Derivation_sti ": Derivation_sti, # fi, # <<<<<<<<<<<<<<
* "Derivation_inen ": Derivation_inen, # fi,
* "Derivation_lainen ": Derivation_lainen, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_sti); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_sti, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":293
* "Derivation_minen ": Derivation_minen, # fi,
* "Derivation_sti ": Derivation_sti, # fi,
* "Derivation_inen ": Derivation_inen, # fi, # <<<<<<<<<<<<<<
* "Derivation_lainen ": Derivation_lainen, # fi,
* "Derivation_ja ": Derivation_ja, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_inen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_inen, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":294
* "Derivation_sti ": Derivation_sti, # fi,
* "Derivation_inen ": Derivation_inen, # fi,
* "Derivation_lainen ": Derivation_lainen, # fi, # <<<<<<<<<<<<<<
* "Derivation_ja ": Derivation_ja, # fi,
* "Derivation_ton ": Derivation_ton, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_lainen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_lainen, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":295
* "Derivation_inen ": Derivation_inen, # fi,
* "Derivation_lainen ": Derivation_lainen, # fi,
* "Derivation_ja ": Derivation_ja, # fi, # <<<<<<<<<<<<<<
* "Derivation_ton ": Derivation_ton, # fi,
* "Derivation_vs ": Derivation_vs, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ja); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_ja, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":296
* "Derivation_lainen ": Derivation_lainen, # fi,
* "Derivation_ja ": Derivation_ja, # fi,
* "Derivation_ton ": Derivation_ton, # fi, # <<<<<<<<<<<<<<
* "Derivation_vs ": Derivation_vs, # fi,
* "Derivation_ttain ": Derivation_ttain, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ton); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_ton, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":297
* "Derivation_ja ": Derivation_ja, # fi,
* "Derivation_ton ": Derivation_ton, # fi,
* "Derivation_vs ": Derivation_vs, # fi, # <<<<<<<<<<<<<<
* "Derivation_ttain ": Derivation_ttain, # fi,
* "Derivation_ttaa ": Derivation_ttaa, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_vs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_vs, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":298
* "Derivation_ton ": Derivation_ton, # fi,
* "Derivation_vs ": Derivation_vs, # fi,
* "Derivation_ttain ": Derivation_ttain, # fi, # <<<<<<<<<<<<<<
* "Derivation_ttaa ": Derivation_ttaa, # fi,
* "Echo_rdp ": Echo_rdp, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ttain); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_ttain, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":299
* "Derivation_vs ": Derivation_vs, # fi,
* "Derivation_ttain ": Derivation_ttain, # fi,
* "Derivation_ttaa ": Derivation_ttaa, # fi, # <<<<<<<<<<<<<<
* "Echo_rdp ": Echo_rdp, # U,
* "Echo_ech ": Echo_ech, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ttaa); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Derivation_ttaa, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":300
* "Derivation_ttain ": Derivation_ttain, # fi,
* "Derivation_ttaa ": Derivation_ttaa, # fi,
* "Echo_rdp ": Echo_rdp, # U, # <<<<<<<<<<<<<<
* "Echo_ech ": Echo_ech, # U,
* "Foreign_foreign ": Foreign_foreign, # cz, fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Echo_rdp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Echo_rdp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":301
* "Derivation_ttaa ": Derivation_ttaa, # fi,
* "Echo_rdp ": Echo_rdp, # U,
* "Echo_ech ": Echo_ech, # U, # <<<<<<<<<<<<<<
* "Foreign_foreign ": Foreign_foreign, # cz, fi, U,
* "Foreign_fscript ": Foreign_fscript, # cz, fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Echo_ech); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Echo_ech, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":302
* "Echo_rdp ": Echo_rdp, # U,
* "Echo_ech ": Echo_ech, # U,
* "Foreign_foreign ": Foreign_foreign, # cz, fi, U, # <<<<<<<<<<<<<<
* "Foreign_fscript ": Foreign_fscript, # cz, fi, U,
* "Foreign_tscript ": Foreign_tscript, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_foreign); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Foreign_foreign, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":303
* "Echo_ech ": Echo_ech, # U,
* "Foreign_foreign ": Foreign_foreign, # cz, fi, U,
* "Foreign_fscript ": Foreign_fscript, # cz, fi, U, # <<<<<<<<<<<<<<
* "Foreign_tscript ": Foreign_tscript, # cz, U,
* "Foreign_yes ": Foreign_yes, # sl,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_fscript); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Foreign_fscript, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":304
* "Foreign_foreign ": Foreign_foreign, # cz, fi, U,
* "Foreign_fscript ": Foreign_fscript, # cz, fi, U,
* "Foreign_tscript ": Foreign_tscript, # cz, U, # <<<<<<<<<<<<<<
* "Foreign_yes ": Foreign_yes, # sl,
* "Gender_dat_masc ": Gender_dat_masc, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_tscript); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Foreign_tscript, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":305
* "Foreign_fscript ": Foreign_fscript, # cz, fi, U,
* "Foreign_tscript ": Foreign_tscript, # cz, U,
* "Foreign_yes ": Foreign_yes, # sl, # <<<<<<<<<<<<<<
* "Gender_dat_masc ": Gender_dat_masc, # bq, U,
* "Gender_dat_fem ": Gender_dat_fem, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Foreign_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":306
* "Foreign_tscript ": Foreign_tscript, # cz, U,
* "Foreign_yes ": Foreign_yes, # sl,
* "Gender_dat_masc ": Gender_dat_masc, # bq, U, # <<<<<<<<<<<<<<
* "Gender_dat_fem ": Gender_dat_fem, # bq, U,
* "Gender_erg_masc ": Gender_erg_masc, # bq,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_dat_masc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_dat_masc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":307
* "Foreign_yes ": Foreign_yes, # sl,
* "Gender_dat_masc ": Gender_dat_masc, # bq, U,
* "Gender_dat_fem ": Gender_dat_fem, # bq, U, # <<<<<<<<<<<<<<
* "Gender_erg_masc ": Gender_erg_masc, # bq,
* "Gender_erg_fem ": Gender_erg_fem, # bq,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_dat_fem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_dat_fem, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":308
* "Gender_dat_masc ": Gender_dat_masc, # bq, U,
* "Gender_dat_fem ": Gender_dat_fem, # bq, U,
* "Gender_erg_masc ": Gender_erg_masc, # bq, # <<<<<<<<<<<<<<
* "Gender_erg_fem ": Gender_erg_fem, # bq,
* "Gender_psor_masc ": Gender_psor_masc, # cz, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_erg_masc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_erg_masc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":309
* "Gender_dat_fem ": Gender_dat_fem, # bq, U,
* "Gender_erg_masc ": Gender_erg_masc, # bq,
* "Gender_erg_fem ": Gender_erg_fem, # bq, # <<<<<<<<<<<<<<
* "Gender_psor_masc ": Gender_psor_masc, # cz, sl, U,
* "Gender_psor_fem ": Gender_psor_fem, # cz, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_erg_fem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_erg_fem, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":310
* "Gender_erg_masc ": Gender_erg_masc, # bq,
* "Gender_erg_fem ": Gender_erg_fem, # bq,
* "Gender_psor_masc ": Gender_psor_masc, # cz, sl, U, # <<<<<<<<<<<<<<
* "Gender_psor_fem ": Gender_psor_fem, # cz, sl, U,
* "Gender_psor_neut ": Gender_psor_neut, # sl,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_psor_masc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_psor_masc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":311
* "Gender_erg_fem ": Gender_erg_fem, # bq,
* "Gender_psor_masc ": Gender_psor_masc, # cz, sl, U,
* "Gender_psor_fem ": Gender_psor_fem, # cz, sl, U, # <<<<<<<<<<<<<<
* "Gender_psor_neut ": Gender_psor_neut, # sl,
* "Hyph_yes ": Hyph_yes, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_psor_fem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_psor_fem, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":312
* "Gender_psor_masc ": Gender_psor_masc, # cz, sl, U,
* "Gender_psor_fem ": Gender_psor_fem, # cz, sl, U,
* "Gender_psor_neut ": Gender_psor_neut, # sl, # <<<<<<<<<<<<<<
* "Hyph_yes ": Hyph_yes, # cz, U,
* "InfForm_one ": InfForm_one, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_psor_neut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gender_psor_neut, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":313
* "Gender_psor_fem ": Gender_psor_fem, # cz, sl, U,
* "Gender_psor_neut ": Gender_psor_neut, # sl,
* "Hyph_yes ": Hyph_yes, # cz, U, # <<<<<<<<<<<<<<
* "InfForm_one ": InfForm_one, # fi,
* "InfForm_two ": InfForm_two, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Hyph_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Hyph_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":314
* "Gender_psor_neut ": Gender_psor_neut, # sl,
* "Hyph_yes ": Hyph_yes, # cz, U,
* "InfForm_one ": InfForm_one, # fi, # <<<<<<<<<<<<<<
* "InfForm_two ": InfForm_two, # fi,
* "InfForm_three ": InfForm_three, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_InfForm_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_InfForm_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":315
* "Hyph_yes ": Hyph_yes, # cz, U,
* "InfForm_one ": InfForm_one, # fi,
* "InfForm_two ": InfForm_two, # fi, # <<<<<<<<<<<<<<
* "InfForm_three ": InfForm_three, # fi,
* "NameType_geo ": NameType_geo, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_InfForm_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_InfForm_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":316
* "InfForm_one ": InfForm_one, # fi,
* "InfForm_two ": InfForm_two, # fi,
* "InfForm_three ": InfForm_three, # fi, # <<<<<<<<<<<<<<
* "NameType_geo ": NameType_geo, # U, cz,
* "NameType_prs ": NameType_prs, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_InfForm_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_InfForm_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":317
* "InfForm_two ": InfForm_two, # fi,
* "InfForm_three ": InfForm_three, # fi,
* "NameType_geo ": NameType_geo, # U, cz, # <<<<<<<<<<<<<<
* "NameType_prs ": NameType_prs, # U, cz,
* "NameType_giv ": NameType_giv, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_geo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_geo, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":318
* "InfForm_three ": InfForm_three, # fi,
* "NameType_geo ": NameType_geo, # U, cz,
* "NameType_prs ": NameType_prs, # U, cz, # <<<<<<<<<<<<<<
* "NameType_giv ": NameType_giv, # U, cz,
* "NameType_sur ": NameType_sur, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_prs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_prs, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":319
* "NameType_geo ": NameType_geo, # U, cz,
* "NameType_prs ": NameType_prs, # U, cz,
* "NameType_giv ": NameType_giv, # U, cz, # <<<<<<<<<<<<<<
* "NameType_sur ": NameType_sur, # U, cz,
* "NameType_nat ": NameType_nat, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_giv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_giv, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":320
* "NameType_prs ": NameType_prs, # U, cz,
* "NameType_giv ": NameType_giv, # U, cz,
* "NameType_sur ": NameType_sur, # U, cz, # <<<<<<<<<<<<<<
* "NameType_nat ": NameType_nat, # U, cz,
* "NameType_com ": NameType_com, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_sur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_sur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":321
* "NameType_giv ": NameType_giv, # U, cz,
* "NameType_sur ": NameType_sur, # U, cz,
* "NameType_nat ": NameType_nat, # U, cz, # <<<<<<<<<<<<<<
* "NameType_com ": NameType_com, # U, cz,
* "NameType_pro ": NameType_pro, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_nat); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_nat, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":322
* "NameType_sur ": NameType_sur, # U, cz,
* "NameType_nat ": NameType_nat, # U, cz,
* "NameType_com ": NameType_com, # U, cz, # <<<<<<<<<<<<<<
* "NameType_pro ": NameType_pro, # U, cz,
* "NameType_oth ": NameType_oth, # U, cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_com); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_com, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":323
* "NameType_nat ": NameType_nat, # U, cz,
* "NameType_com ": NameType_com, # U, cz,
* "NameType_pro ": NameType_pro, # U, cz, # <<<<<<<<<<<<<<
* "NameType_oth ": NameType_oth, # U, cz,
* "NounType_com ": NounType_com, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_pro); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_pro, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":324
* "NameType_com ": NameType_com, # U, cz,
* "NameType_pro ": NameType_pro, # U, cz,
* "NameType_oth ": NameType_oth, # U, cz, # <<<<<<<<<<<<<<
* "NounType_com ": NounType_com, # U,
* "NounType_prop ": NounType_prop, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_oth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NameType_oth, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":325
* "NameType_pro ": NameType_pro, # U, cz,
* "NameType_oth ": NameType_oth, # U, cz,
* "NounType_com ": NounType_com, # U, # <<<<<<<<<<<<<<
* "NounType_prop ": NounType_prop, # U,
* "NounType_class ": NounType_class, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NounType_com); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NounType_com, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":326
* "NameType_oth ": NameType_oth, # U, cz,
* "NounType_com ": NounType_com, # U,
* "NounType_prop ": NounType_prop, # U, # <<<<<<<<<<<<<<
* "NounType_class ": NounType_class, # U,
* "Number_abs_sing ": Number_abs_sing, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NounType_prop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NounType_prop, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":327
* "NounType_com ": NounType_com, # U,
* "NounType_prop ": NounType_prop, # U,
* "NounType_class ": NounType_class, # U, # <<<<<<<<<<<<<<
* "Number_abs_sing ": Number_abs_sing, # bq, U,
* "Number_abs_plur ": Number_abs_plur, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NounType_class); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NounType_class, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":328
* "NounType_prop ": NounType_prop, # U,
* "NounType_class ": NounType_class, # U,
* "Number_abs_sing ": Number_abs_sing, # bq, U, # <<<<<<<<<<<<<<
* "Number_abs_plur ": Number_abs_plur, # bq, U,
* "Number_dat_sing ": Number_dat_sing, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_abs_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_abs_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":329
* "NounType_class ": NounType_class, # U,
* "Number_abs_sing ": Number_abs_sing, # bq, U,
* "Number_abs_plur ": Number_abs_plur, # bq, U, # <<<<<<<<<<<<<<
* "Number_dat_sing ": Number_dat_sing, # bq, U,
* "Number_dat_plur ": Number_dat_plur, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_abs_plur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_abs_plur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":330
* "Number_abs_sing ": Number_abs_sing, # bq, U,
* "Number_abs_plur ": Number_abs_plur, # bq, U,
* "Number_dat_sing ": Number_dat_sing, # bq, U, # <<<<<<<<<<<<<<
* "Number_dat_plur ": Number_dat_plur, # bq, U,
* "Number_erg_sing ": Number_erg_sing, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_dat_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_dat_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":331
* "Number_abs_plur ": Number_abs_plur, # bq, U,
* "Number_dat_sing ": Number_dat_sing, # bq, U,
* "Number_dat_plur ": Number_dat_plur, # bq, U, # <<<<<<<<<<<<<<
* "Number_erg_sing ": Number_erg_sing, # bq, U,
* "Number_erg_plur ": Number_erg_plur, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_dat_plur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_dat_plur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":332
* "Number_dat_sing ": Number_dat_sing, # bq, U,
* "Number_dat_plur ": Number_dat_plur, # bq, U,
* "Number_erg_sing ": Number_erg_sing, # bq, U, # <<<<<<<<<<<<<<
* "Number_erg_plur ": Number_erg_plur, # bq, U,
* "Number_psee_sing ": Number_psee_sing, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_erg_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_erg_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":333
* "Number_dat_plur ": Number_dat_plur, # bq, U,
* "Number_erg_sing ": Number_erg_sing, # bq, U,
* "Number_erg_plur ": Number_erg_plur, # bq, U, # <<<<<<<<<<<<<<
* "Number_psee_sing ": Number_psee_sing, # U,
* "Number_psee_plur ": Number_psee_plur, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_erg_plur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_erg_plur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":334
* "Number_erg_sing ": Number_erg_sing, # bq, U,
* "Number_erg_plur ": Number_erg_plur, # bq, U,
* "Number_psee_sing ": Number_psee_sing, # U, # <<<<<<<<<<<<<<
* "Number_psee_plur ": Number_psee_plur, # U,
* "Number_psor_sing ": Number_psor_sing, # cz, fi, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psee_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_psee_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":335
* "Number_erg_plur ": Number_erg_plur, # bq, U,
* "Number_psee_sing ": Number_psee_sing, # U,
* "Number_psee_plur ": Number_psee_plur, # U, # <<<<<<<<<<<<<<
* "Number_psor_sing ": Number_psor_sing, # cz, fi, sl, U,
* "Number_psor_plur ": Number_psor_plur, # cz, fi, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psee_plur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_psee_plur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":336
* "Number_psee_sing ": Number_psee_sing, # U,
* "Number_psee_plur ": Number_psee_plur, # U,
* "Number_psor_sing ": Number_psor_sing, # cz, fi, sl, U, # <<<<<<<<<<<<<<
* "Number_psor_plur ": Number_psor_plur, # cz, fi, sl, U,
* "NumForm_digit ": NumForm_digit, # cz, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psor_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_psor_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":337
* "Number_psee_plur ": Number_psee_plur, # U,
* "Number_psor_sing ": Number_psor_sing, # cz, fi, sl, U,
* "Number_psor_plur ": Number_psor_plur, # cz, fi, sl, U, # <<<<<<<<<<<<<<
* "NumForm_digit ": NumForm_digit, # cz, sl, U,
* "NumForm_roman ": NumForm_roman, # cz, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psor_plur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Number_psor_plur, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":338
* "Number_psor_sing ": Number_psor_sing, # cz, fi, sl, U,
* "Number_psor_plur ": Number_psor_plur, # cz, fi, sl, U,
* "NumForm_digit ": NumForm_digit, # cz, sl, U, # <<<<<<<<<<<<<<
* "NumForm_roman ": NumForm_roman, # cz, sl, U,
* "NumForm_word ": NumForm_word, # cz, sl, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumForm_digit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NumForm_digit, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":339
* "Number_psor_plur ": Number_psor_plur, # cz, fi, sl, U,
* "NumForm_digit ": NumForm_digit, # cz, sl, U,
* "NumForm_roman ": NumForm_roman, # cz, sl, U, # <<<<<<<<<<<<<<
* "NumForm_word ": NumForm_word, # cz, sl, U,
* "NumValue_one ": NumValue_one, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumForm_roman); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NumForm_roman, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":340
* "NumForm_digit ": NumForm_digit, # cz, sl, U,
* "NumForm_roman ": NumForm_roman, # cz, sl, U,
* "NumForm_word ": NumForm_word, # cz, sl, U, # <<<<<<<<<<<<<<
* "NumValue_one ": NumValue_one, # cz, U,
* "NumValue_two ": NumValue_two, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumForm_word); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NumForm_word, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":341
* "NumForm_roman ": NumForm_roman, # cz, sl, U,
* "NumForm_word ": NumForm_word, # cz, sl, U,
* "NumValue_one ": NumValue_one, # cz, U, # <<<<<<<<<<<<<<
* "NumValue_two ": NumValue_two, # cz, U,
* "NumValue_three ": NumValue_three, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumValue_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NumValue_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":342
* "NumForm_word ": NumForm_word, # cz, sl, U,
* "NumValue_one ": NumValue_one, # cz, U,
* "NumValue_two ": NumValue_two, # cz, U, # <<<<<<<<<<<<<<
* "NumValue_three ": NumValue_three, # cz, U,
* "PartForm_pres ": PartForm_pres, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumValue_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NumValue_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":343
* "NumValue_one ": NumValue_one, # cz, U,
* "NumValue_two ": NumValue_two, # cz, U,
* "NumValue_three ": NumValue_three, # cz, U, # <<<<<<<<<<<<<<
* "PartForm_pres ": PartForm_pres, # fi,
* "PartForm_past ": PartForm_past, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumValue_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_NumValue_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":344
* "NumValue_two ": NumValue_two, # cz, U,
* "NumValue_three ": NumValue_three, # cz, U,
* "PartForm_pres ": PartForm_pres, # fi, # <<<<<<<<<<<<<<
* "PartForm_past ": PartForm_past, # fi,
* "PartForm_agt ": PartForm_agt, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_pres); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartForm_pres, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":345
* "NumValue_three ": NumValue_three, # cz, U,
* "PartForm_pres ": PartForm_pres, # fi,
* "PartForm_past ": PartForm_past, # fi, # <<<<<<<<<<<<<<
* "PartForm_agt ": PartForm_agt, # fi,
* "PartForm_neg ": PartForm_neg, # fi,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_past); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartForm_past, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":346
* "PartForm_pres ": PartForm_pres, # fi,
* "PartForm_past ": PartForm_past, # fi,
* "PartForm_agt ": PartForm_agt, # fi, # <<<<<<<<<<<<<<
* "PartForm_neg ": PartForm_neg, # fi,
* "PartType_mod ": PartType_mod, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_agt); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartForm_agt, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":347
* "PartForm_past ": PartForm_past, # fi,
* "PartForm_agt ": PartForm_agt, # fi,
* "PartForm_neg ": PartForm_neg, # fi, # <<<<<<<<<<<<<<
* "PartType_mod ": PartType_mod, # U,
* "PartType_emp ": PartType_emp, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_neg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartForm_neg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":348
* "PartForm_agt ": PartForm_agt, # fi,
* "PartForm_neg ": PartForm_neg, # fi,
* "PartType_mod ": PartType_mod, # U, # <<<<<<<<<<<<<<
* "PartType_emp ": PartType_emp, # U,
* "PartType_res ": PartType_res, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_mod); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartType_mod, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":349
* "PartForm_neg ": PartForm_neg, # fi,
* "PartType_mod ": PartType_mod, # U,
* "PartType_emp ": PartType_emp, # U, # <<<<<<<<<<<<<<
* "PartType_res ": PartType_res, # U,
* "PartType_inf ": PartType_inf, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_emp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartType_emp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":350
* "PartType_mod ": PartType_mod, # U,
* "PartType_emp ": PartType_emp, # U,
* "PartType_res ": PartType_res, # U, # <<<<<<<<<<<<<<
* "PartType_inf ": PartType_inf, # U,
* "PartType_vbp ": PartType_vbp, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartType_res, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":351
* "PartType_emp ": PartType_emp, # U,
* "PartType_res ": PartType_res, # U,
* "PartType_inf ": PartType_inf, # U, # <<<<<<<<<<<<<<
* "PartType_vbp ": PartType_vbp, # U,
* "Person_abs_one ": Person_abs_one, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartType_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":352
* "PartType_res ": PartType_res, # U,
* "PartType_inf ": PartType_inf, # U,
* "PartType_vbp ": PartType_vbp, # U, # <<<<<<<<<<<<<<
* "Person_abs_one ": Person_abs_one, # bq, U,
* "Person_abs_two ": Person_abs_two, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_vbp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PartType_vbp, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":353
* "PartType_inf ": PartType_inf, # U,
* "PartType_vbp ": PartType_vbp, # U,
* "Person_abs_one ": Person_abs_one, # bq, U, # <<<<<<<<<<<<<<
* "Person_abs_two ": Person_abs_two, # bq, U,
* "Person_abs_three ": Person_abs_three, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_abs_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_abs_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":354
* "PartType_vbp ": PartType_vbp, # U,
* "Person_abs_one ": Person_abs_one, # bq, U,
* "Person_abs_two ": Person_abs_two, # bq, U, # <<<<<<<<<<<<<<
* "Person_abs_three ": Person_abs_three, # bq, U,
* "Person_dat_one ": Person_dat_one, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_abs_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_abs_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":355
* "Person_abs_one ": Person_abs_one, # bq, U,
* "Person_abs_two ": Person_abs_two, # bq, U,
* "Person_abs_three ": Person_abs_three, # bq, U, # <<<<<<<<<<<<<<
* "Person_dat_one ": Person_dat_one, # bq, U,
* "Person_dat_two ": Person_dat_two, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_abs_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_abs_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":356
* "Person_abs_two ": Person_abs_two, # bq, U,
* "Person_abs_three ": Person_abs_three, # bq, U,
* "Person_dat_one ": Person_dat_one, # bq, U, # <<<<<<<<<<<<<<
* "Person_dat_two ": Person_dat_two, # bq, U,
* "Person_dat_three ": Person_dat_three, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_dat_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_dat_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":357
* "Person_abs_three ": Person_abs_three, # bq, U,
* "Person_dat_one ": Person_dat_one, # bq, U,
* "Person_dat_two ": Person_dat_two, # bq, U, # <<<<<<<<<<<<<<
* "Person_dat_three ": Person_dat_three, # bq, U,
* "Person_erg_one ": Person_erg_one, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_dat_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_dat_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":358
* "Person_dat_one ": Person_dat_one, # bq, U,
* "Person_dat_two ": Person_dat_two, # bq, U,
* "Person_dat_three ": Person_dat_three, # bq, U, # <<<<<<<<<<<<<<
* "Person_erg_one ": Person_erg_one, # bq, U,
* "Person_erg_two ": Person_erg_two, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_dat_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_dat_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":359
* "Person_dat_two ": Person_dat_two, # bq, U,
* "Person_dat_three ": Person_dat_three, # bq, U,
* "Person_erg_one ": Person_erg_one, # bq, U, # <<<<<<<<<<<<<<
* "Person_erg_two ": Person_erg_two, # bq, U,
* "Person_erg_three ": Person_erg_three, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_erg_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_erg_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":360
* "Person_dat_three ": Person_dat_three, # bq, U,
* "Person_erg_one ": Person_erg_one, # bq, U,
* "Person_erg_two ": Person_erg_two, # bq, U, # <<<<<<<<<<<<<<
* "Person_erg_three ": Person_erg_three, # bq, U,
* "Person_psor_one ": Person_psor_one, # fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_erg_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_erg_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":361
* "Person_erg_one ": Person_erg_one, # bq, U,
* "Person_erg_two ": Person_erg_two, # bq, U,
* "Person_erg_three ": Person_erg_three, # bq, U, # <<<<<<<<<<<<<<
* "Person_psor_one ": Person_psor_one, # fi, U,
* "Person_psor_two ": Person_psor_two, # fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_erg_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_erg_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":362
* "Person_erg_two ": Person_erg_two, # bq, U,
* "Person_erg_three ": Person_erg_three, # bq, U,
* "Person_psor_one ": Person_psor_one, # fi, U, # <<<<<<<<<<<<<<
* "Person_psor_two ": Person_psor_two, # fi, U,
* "Person_psor_three ": Person_psor_three, # fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_psor_one); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_psor_one, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":363
* "Person_erg_three ": Person_erg_three, # bq, U,
* "Person_psor_one ": Person_psor_one, # fi, U,
* "Person_psor_two ": Person_psor_two, # fi, U, # <<<<<<<<<<<<<<
* "Person_psor_three ": Person_psor_three, # fi, U,
* "Polite_inf ": Polite_inf, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_psor_two); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_psor_two, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":364
* "Person_psor_one ": Person_psor_one, # fi, U,
* "Person_psor_two ": Person_psor_two, # fi, U,
* "Person_psor_three ": Person_psor_three, # fi, U, # <<<<<<<<<<<<<<
* "Polite_inf ": Polite_inf, # bq, U,
* "Polite_pol ": Polite_pol, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_psor_three); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Person_psor_three, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":365
* "Person_psor_two ": Person_psor_two, # fi, U,
* "Person_psor_three ": Person_psor_three, # fi, U,
* "Polite_inf ": Polite_inf, # bq, U, # <<<<<<<<<<<<<<
* "Polite_pol ": Polite_pol, # bq, U,
* "Polite_abs_inf ": Polite_abs_inf, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":366
* "Person_psor_three ": Person_psor_three, # fi, U,
* "Polite_inf ": Polite_inf, # bq, U,
* "Polite_pol ": Polite_pol, # bq, U, # <<<<<<<<<<<<<<
* "Polite_abs_inf ": Polite_abs_inf, # bq, U,
* "Polite_abs_pol ": Polite_abs_pol, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_pol); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_pol, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":367
* "Polite_inf ": Polite_inf, # bq, U,
* "Polite_pol ": Polite_pol, # bq, U,
* "Polite_abs_inf ": Polite_abs_inf, # bq, U, # <<<<<<<<<<<<<<
* "Polite_abs_pol ": Polite_abs_pol, # bq, U,
* "Polite_erg_inf ": Polite_erg_inf, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_abs_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_abs_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":368
* "Polite_pol ": Polite_pol, # bq, U,
* "Polite_abs_inf ": Polite_abs_inf, # bq, U,
* "Polite_abs_pol ": Polite_abs_pol, # bq, U, # <<<<<<<<<<<<<<
* "Polite_erg_inf ": Polite_erg_inf, # bq, U,
* "Polite_erg_pol ": Polite_erg_pol, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_abs_pol); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_abs_pol, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":369
* "Polite_abs_inf ": Polite_abs_inf, # bq, U,
* "Polite_abs_pol ": Polite_abs_pol, # bq, U,
* "Polite_erg_inf ": Polite_erg_inf, # bq, U, # <<<<<<<<<<<<<<
* "Polite_erg_pol ": Polite_erg_pol, # bq, U,
* "Polite_dat_inf ": Polite_dat_inf, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_erg_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_erg_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":370
* "Polite_abs_pol ": Polite_abs_pol, # bq, U,
* "Polite_erg_inf ": Polite_erg_inf, # bq, U,
* "Polite_erg_pol ": Polite_erg_pol, # bq, U, # <<<<<<<<<<<<<<
* "Polite_dat_inf ": Polite_dat_inf, # bq, U,
* "Polite_dat_pol ": Polite_dat_pol, # bq, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_erg_pol); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_erg_pol, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":371
* "Polite_erg_inf ": Polite_erg_inf, # bq, U,
* "Polite_erg_pol ": Polite_erg_pol, # bq, U,
* "Polite_dat_inf ": Polite_dat_inf, # bq, U, # <<<<<<<<<<<<<<
* "Polite_dat_pol ": Polite_dat_pol, # bq, U,
* "Prefix_yes ": Prefix_yes, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_dat_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_dat_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":372
* "Polite_erg_pol ": Polite_erg_pol, # bq, U,
* "Polite_dat_inf ": Polite_dat_inf, # bq, U,
* "Polite_dat_pol ": Polite_dat_pol, # bq, U, # <<<<<<<<<<<<<<
* "Prefix_yes ": Prefix_yes, # U,
* "PrepCase_npr ": PrepCase_npr, # cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_dat_pol); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Polite_dat_pol, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":373
* "Polite_dat_inf ": Polite_dat_inf, # bq, U,
* "Polite_dat_pol ": Polite_dat_pol, # bq, U,
* "Prefix_yes ": Prefix_yes, # U, # <<<<<<<<<<<<<<
* "PrepCase_npr ": PrepCase_npr, # cz,
* "PrepCase_pre ": PrepCase_pre, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Prefix_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Prefix_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":374
* "Polite_dat_pol ": Polite_dat_pol, # bq, U,
* "Prefix_yes ": Prefix_yes, # U,
* "PrepCase_npr ": PrepCase_npr, # cz, # <<<<<<<<<<<<<<
* "PrepCase_pre ": PrepCase_pre, # U,
* "PunctSide_ini ": PunctSide_ini, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PrepCase_npr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PrepCase_npr, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":375
* "Prefix_yes ": Prefix_yes, # U,
* "PrepCase_npr ": PrepCase_npr, # cz,
* "PrepCase_pre ": PrepCase_pre, # U, # <<<<<<<<<<<<<<
* "PunctSide_ini ": PunctSide_ini, # U,
* "PunctSide_fin ": PunctSide_fin, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PrepCase_pre); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PrepCase_pre, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":376
* "PrepCase_npr ": PrepCase_npr, # cz,
* "PrepCase_pre ": PrepCase_pre, # U,
* "PunctSide_ini ": PunctSide_ini, # U, # <<<<<<<<<<<<<<
* "PunctSide_fin ": PunctSide_fin, # U,
* "PunctType_peri ": PunctType_peri, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctSide_ini); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctSide_ini, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":377
* "PrepCase_pre ": PrepCase_pre, # U,
* "PunctSide_ini ": PunctSide_ini, # U,
* "PunctSide_fin ": PunctSide_fin, # U, # <<<<<<<<<<<<<<
* "PunctType_peri ": PunctType_peri, # U,
* "PunctType_qest ": PunctType_qest, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctSide_fin); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctSide_fin, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":378
* "PunctSide_ini ": PunctSide_ini, # U,
* "PunctSide_fin ": PunctSide_fin, # U,
* "PunctType_peri ": PunctType_peri, # U, # <<<<<<<<<<<<<<
* "PunctType_qest ": PunctType_qest, # U,
* "PunctType_excl ": PunctType_excl, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_peri); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_peri, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":379
* "PunctSide_fin ": PunctSide_fin, # U,
* "PunctType_peri ": PunctType_peri, # U,
* "PunctType_qest ": PunctType_qest, # U, # <<<<<<<<<<<<<<
* "PunctType_excl ": PunctType_excl, # U,
* "PunctType_quot ": PunctType_quot, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_qest); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_qest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":380
* "PunctType_peri ": PunctType_peri, # U,
* "PunctType_qest ": PunctType_qest, # U,
* "PunctType_excl ": PunctType_excl, # U, # <<<<<<<<<<<<<<
* "PunctType_quot ": PunctType_quot, # U,
* "PunctType_brck ": PunctType_brck, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_excl); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_excl, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":381
* "PunctType_qest ": PunctType_qest, # U,
* "PunctType_excl ": PunctType_excl, # U,
* "PunctType_quot ": PunctType_quot, # U, # <<<<<<<<<<<<<<
* "PunctType_brck ": PunctType_brck, # U,
* "PunctType_comm ": PunctType_comm, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_quot); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_quot, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":382
* "PunctType_excl ": PunctType_excl, # U,
* "PunctType_quot ": PunctType_quot, # U,
* "PunctType_brck ": PunctType_brck, # U, # <<<<<<<<<<<<<<
* "PunctType_comm ": PunctType_comm, # U,
* "PunctType_colo ": PunctType_colo, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_brck); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_brck, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":383
* "PunctType_quot ": PunctType_quot, # U,
* "PunctType_brck ": PunctType_brck, # U,
* "PunctType_comm ": PunctType_comm, # U, # <<<<<<<<<<<<<<
* "PunctType_colo ": PunctType_colo, # U,
* "PunctType_semi ": PunctType_semi, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_comm); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_comm, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":384
* "PunctType_brck ": PunctType_brck, # U,
* "PunctType_comm ": PunctType_comm, # U,
* "PunctType_colo ": PunctType_colo, # U, # <<<<<<<<<<<<<<
* "PunctType_semi ": PunctType_semi, # U,
* "PunctType_dash ": PunctType_dash, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_colo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_colo, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":385
* "PunctType_comm ": PunctType_comm, # U,
* "PunctType_colo ": PunctType_colo, # U,
* "PunctType_semi ": PunctType_semi, # U, # <<<<<<<<<<<<<<
* "PunctType_dash ": PunctType_dash, # U,
* "Style_arch ": Style_arch, # cz, fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_semi); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_semi, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":386
* "PunctType_colo ": PunctType_colo, # U,
* "PunctType_semi ": PunctType_semi, # U,
* "PunctType_dash ": PunctType_dash, # U, # <<<<<<<<<<<<<<
* "Style_arch ": Style_arch, # cz, fi, U,
* "Style_rare ": Style_rare, # cz, fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_dash); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_PunctType_dash, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":387
* "PunctType_semi ": PunctType_semi, # U,
* "PunctType_dash ": PunctType_dash, # U,
* "Style_arch ": Style_arch, # cz, fi, U, # <<<<<<<<<<<<<<
* "Style_rare ": Style_rare, # cz, fi, U,
* "Style_poet ": Style_poet, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_arch); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_arch, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":388
* "PunctType_dash ": PunctType_dash, # U,
* "Style_arch ": Style_arch, # cz, fi, U,
* "Style_rare ": Style_rare, # cz, fi, U, # <<<<<<<<<<<<<<
* "Style_poet ": Style_poet, # cz, U,
* "Style_norm ": Style_norm, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_rare); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_rare, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":389
* "Style_arch ": Style_arch, # cz, fi, U,
* "Style_rare ": Style_rare, # cz, fi, U,
* "Style_poet ": Style_poet, # cz, U, # <<<<<<<<<<<<<<
* "Style_norm ": Style_norm, # cz, U,
* "Style_coll ": Style_coll, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_poet); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_poet, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":390
* "Style_rare ": Style_rare, # cz, fi, U,
* "Style_poet ": Style_poet, # cz, U,
* "Style_norm ": Style_norm, # cz, U, # <<<<<<<<<<<<<<
* "Style_coll ": Style_coll, # cz, U,
* "Style_vrnc ": Style_vrnc, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_norm); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_norm, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":391
* "Style_poet ": Style_poet, # cz, U,
* "Style_norm ": Style_norm, # cz, U,
* "Style_coll ": Style_coll, # cz, U, # <<<<<<<<<<<<<<
* "Style_vrnc ": Style_vrnc, # cz, U,
* "Style_sing ": Style_sing, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_coll); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_coll, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":392
* "Style_norm ": Style_norm, # cz, U,
* "Style_coll ": Style_coll, # cz, U,
* "Style_vrnc ": Style_vrnc, # cz, U, # <<<<<<<<<<<<<<
* "Style_sing ": Style_sing, # cz, U,
* "Style_expr ": Style_expr, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_vrnc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_vrnc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":393
* "Style_coll ": Style_coll, # cz, U,
* "Style_vrnc ": Style_vrnc, # cz, U,
* "Style_sing ": Style_sing, # cz, U, # <<<<<<<<<<<<<<
* "Style_expr ": Style_expr, # cz, U,
* "Style_derg ": Style_derg, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_sing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_sing, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":394
* "Style_vrnc ": Style_vrnc, # cz, U,
* "Style_sing ": Style_sing, # cz, U,
* "Style_expr ": Style_expr, # cz, U, # <<<<<<<<<<<<<<
* "Style_derg ": Style_derg, # cz, U,
* "Style_vulg ": Style_vulg, # cz, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_expr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_expr, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":395
* "Style_sing ": Style_sing, # cz, U,
* "Style_expr ": Style_expr, # cz, U,
* "Style_derg ": Style_derg, # cz, U, # <<<<<<<<<<<<<<
* "Style_vulg ": Style_vulg, # cz, U,
* "Style_yes ": Style_yes, # fi, U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_derg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_derg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":396
* "Style_expr ": Style_expr, # cz, U,
* "Style_derg ": Style_derg, # cz, U,
* "Style_vulg ": Style_vulg, # cz, U, # <<<<<<<<<<<<<<
* "Style_yes ": Style_yes, # fi, U,
* "StyleVariant_styleShort ": StyleVariant_styleShort, # cz,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_vulg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_vulg, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":397
* "Style_derg ": Style_derg, # cz, U,
* "Style_vulg ": Style_vulg, # cz, U,
* "Style_yes ": Style_yes, # fi, U, # <<<<<<<<<<<<<<
* "StyleVariant_styleShort ": StyleVariant_styleShort, # cz,
* "StyleVariant_styleBound ": StyleVariant_styleBound, # cz, sl,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_yes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Style_yes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":398
* "Style_vulg ": Style_vulg, # cz, U,
* "Style_yes ": Style_yes, # fi, U,
* "StyleVariant_styleShort ": StyleVariant_styleShort, # cz, # <<<<<<<<<<<<<<
* "StyleVariant_styleBound ": StyleVariant_styleBound, # cz, sl,
* "VerbType_aux ": VerbType_aux, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_StyleVariant_styleShort); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_StyleVariant_styleShort, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":399
* "Style_yes ": Style_yes, # fi, U,
* "StyleVariant_styleShort ": StyleVariant_styleShort, # cz,
* "StyleVariant_styleBound ": StyleVariant_styleBound, # cz, sl, # <<<<<<<<<<<<<<
* "VerbType_aux ": VerbType_aux, # U,
* "VerbType_cop ": VerbType_cop, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_StyleVariant_styleBound); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_StyleVariant_styleBound, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":400
* "StyleVariant_styleShort ": StyleVariant_styleShort, # cz,
* "StyleVariant_styleBound ": StyleVariant_styleBound, # cz, sl,
* "VerbType_aux ": VerbType_aux, # U, # <<<<<<<<<<<<<<
* "VerbType_cop ": VerbType_cop, # U,
* "VerbType_mod ": VerbType_mod, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_aux); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_VerbType_aux, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":401
* "StyleVariant_styleBound ": StyleVariant_styleBound, # cz, sl,
* "VerbType_aux ": VerbType_aux, # U,
* "VerbType_cop ": VerbType_cop, # U, # <<<<<<<<<<<<<<
* "VerbType_mod ": VerbType_mod, # U,
* "VerbType_light ": VerbType_light, # U,
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_cop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_VerbType_cop, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":402
* "VerbType_aux ": VerbType_aux, # U,
* "VerbType_cop ": VerbType_cop, # U,
* "VerbType_mod ": VerbType_mod, # U, # <<<<<<<<<<<<<<
* "VerbType_light ": VerbType_light, # U,
* }
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_mod); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_VerbType_mod, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "spacy\morphology.pyx":403
* "VerbType_cop ": VerbType_cop, # U,
* "VerbType_mod ": VerbType_mod, # U,
* "VerbType_light ": VerbType_light, # U, # <<<<<<<<<<<<<<
* }
*
*/
__pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_light); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_VerbType_light, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_IDS, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "spacy\morphology.pyx":407
*
*
* NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])] # <<<<<<<<<<<<<<
*/
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_IDS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_items); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_6)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
}
}
if (__pyx_t_6) {
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
} else {
__pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5spacy_10morphology_2lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_spacy_morphology, __pyx_d, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_key, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
__pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
__pyx_t_9 = NULL;
} else {
__pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
for (;;) {
if (likely(!__pyx_t_9)) {
if (likely(PyList_CheckExact(__pyx_t_5))) {
if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
} else {
if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
}
} else {
__pyx_t_6 = __pyx_t_9(__pyx_t_5);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_6);
}
if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
PyObject* sequence = __pyx_t_6;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_7 = PyList_GET_ITEM(sequence, 0);
__pyx_t_10 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx_t_10);
#else
__pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
#endif
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L5_unpacking_done;
__pyx_L4_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L5_unpacking_done:;
}
if (PyDict_SetItem(__pyx_d, __pyx_n_s_key, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_value, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_key); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_NAMES, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "spacy\morphology.pyx":1
* # cython: infer_types # <<<<<<<<<<<<<<
* # coding: utf8
* from __future__ import unicode_literals
*/
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "lexeme.pxd":86
*
* @staticmethod
* cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) nogil: # <<<<<<<<<<<<<<
* cdef flags_t one = 1
* if value:
*/
/*--- Wrapped vars code ---*/
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NIL);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NIL", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Animacy_anim);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Animacy_anim", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Animacy_inam);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Animacy_inam", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_freq);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Aspect_freq", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_imp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Aspect_imp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_mod);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Aspect_mod", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_none);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Aspect_none", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Aspect_perf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Aspect_perf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_abe);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_abe", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_abl);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_abl", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_abs);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_abs", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_acc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_acc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ade);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ade", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_all);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_all", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_cau);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_cau", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_com);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_com", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_dat);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_dat", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_del);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_del", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_dis);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_dis", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ela);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ela", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ess);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ess", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_gen);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_gen", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ill);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ill", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ine);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ine", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ins);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ins", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_loc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_loc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_lat);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_lat", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_nom);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_nom", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_par);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_par", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_sub);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_sub", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_sup);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_sup", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_tem);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_tem", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_ter);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_ter", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_tra);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_tra", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Case_voc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Case_voc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Definite_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_def);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Definite_def", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_red);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Definite_red", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_cons);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Definite_cons", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Definite_ind);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Definite_ind", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_cmp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_cmp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_comp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_comp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_none);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_none", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_pos);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_pos", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_sup);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_sup", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_abs);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_abs", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_com);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_com", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Degree_dim);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Degree_dim", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_com);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_com", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_fem);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_fem", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_masc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_masc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_neut);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_neut", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_cnd);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_cnd", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_imp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_imp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_ind);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_ind", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_n);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_n", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_pot);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_pot", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_sub);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_sub", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Mood_opt);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Mood_opt", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Negative_neg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Negative_neg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Negative_pos);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Negative_pos", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Negative_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Negative_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polarity_neg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polarity_neg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polarity_pos);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polarity_pos", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_com);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_com", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_dual);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_dual", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_none);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_none", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_plur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_plur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_ptan);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_ptan", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_count);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_count", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_card);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_card", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_dist);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_dist", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_frac);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_frac", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_gen);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_gen", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_mult);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_mult", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_none);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_none", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_ord);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_ord", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumType_sets);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumType_sets", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_none);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_none", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Poss_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Poss_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_advPart);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_advPart", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_art);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_art", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_default);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_default", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_dem);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_dem", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_ind);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_ind", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_int);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_int", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_neg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_neg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_prs);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_prs", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_rcp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_rcp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_rel);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_rel", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_tot);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_tot", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_clit);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_clit", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PronType_exc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PronType_exc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Reflex_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Reflex_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_fut);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Tense_fut", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_imp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Tense_imp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_past);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Tense_past", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Tense_pres);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Tense_pres", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_fin);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_fin", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_ger);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_ger", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_inf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_inf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_none);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_none", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_part);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_part", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_partFut);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_partFut", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_partPast);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_partPast", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_partPres);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_partPres", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_sup);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_sup", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_trans);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_trans", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_conv);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_conv", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbForm_gdv);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbForm_gdv", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_act);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Voice_act", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_cau);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Voice_cau", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_pass);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Voice_pass", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_mid);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Voice_mid", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Voice_int);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Voice_int", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Abbr_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Abbr_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_prep);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdpType_prep", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_post);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdpType_post", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_voc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdpType_voc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_comprep);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdpType_comprep", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdpType_circ);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdpType_circ", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_man);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_man", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_loc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_loc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_tim);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_tim", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_deg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_deg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_cau);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_cau", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_mod);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_mod", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_sta);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_sta", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_ex);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_ex", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_AdvType_adadj);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "AdvType_adadj", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_ConjType_oper);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "ConjType_oper", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_ConjType_comp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "ConjType_comp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Connegative_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Connegative_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_minen);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_minen", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_sti);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_sti", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_inen);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_inen", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_lainen);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_lainen", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ja);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_ja", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ton);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_ton", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_vs);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_vs", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ttain);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_ttain", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Derivation_ttaa);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Derivation_ttaa", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Echo_rdp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Echo_rdp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Echo_ech);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Echo_ech", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_foreign);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Foreign_foreign", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_fscript);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Foreign_fscript", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_tscript);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Foreign_tscript", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Foreign_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Foreign_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_dat_masc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_dat_masc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_dat_fem);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_dat_fem", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_erg_masc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_erg_masc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_erg_fem);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_erg_fem", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_psor_masc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_psor_masc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_psor_fem);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_psor_fem", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Gender_psor_neut);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Gender_psor_neut", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Hyph_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Hyph_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_InfForm_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "InfForm_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_InfForm_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "InfForm_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_InfForm_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "InfForm_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_geo);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_geo", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_prs);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_prs", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_giv);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_giv", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_sur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_sur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_nat);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_nat", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_com);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_com", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_pro);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_pro", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NameType_oth);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NameType_oth", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NounType_com);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NounType_com", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NounType_prop);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NounType_prop", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NounType_class);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NounType_class", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_abs_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_abs_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_abs_plur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_abs_plur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_dat_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_dat_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_dat_plur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_dat_plur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_erg_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_erg_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_erg_plur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_erg_plur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psee_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_psee_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psee_plur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_psee_plur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psor_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_psor_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Number_psor_plur);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Number_psor_plur", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumForm_digit);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumForm_digit", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumForm_roman);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumForm_roman", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumForm_word);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumForm_word", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumValue_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumValue_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumValue_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumValue_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_NumValue_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "NumValue_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_pres);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartForm_pres", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_past);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartForm_past", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_agt);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartForm_agt", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartForm_neg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartForm_neg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_mod);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartType_mod", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_emp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartType_emp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_res);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartType_res", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_inf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartType_inf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PartType_vbp);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PartType_vbp", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_abs_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_abs_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_abs_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_abs_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_abs_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_abs_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_dat_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_dat_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_dat_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_dat_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_dat_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_dat_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_erg_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_erg_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_erg_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_erg_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_erg_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_erg_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_psor_one);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_psor_one", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_psor_two);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_psor_two", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Person_psor_three);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Person_psor_three", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_inf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_inf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_pol);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_pol", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_abs_inf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_abs_inf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_abs_pol);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_abs_pol", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_erg_inf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_erg_inf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_erg_pol);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_erg_pol", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_dat_inf);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_dat_inf", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Polite_dat_pol);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polite_dat_pol", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Prefix_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Prefix_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PrepCase_npr);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PrepCase_npr", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PrepCase_pre);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PrepCase_pre", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctSide_ini);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctSide_ini", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctSide_fin);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctSide_fin", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_peri);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_peri", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_qest);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_qest", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_excl);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_excl", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_quot);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_quot", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_brck);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_brck", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_comm);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_comm", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_colo);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_colo", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_semi);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_semi", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_PunctType_dash);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "PunctType_dash", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_arch);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_arch", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_rare);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_rare", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_poet);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_poet", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_norm);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_norm", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_coll);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_coll", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_vrnc);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_vrnc", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_sing);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_sing", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_expr);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_expr", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_derg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_derg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_vulg);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_vulg", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_Style_yes);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Style_yes", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_StyleVariant_styleShort);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "StyleVariant_styleShort", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_StyleVariant_styleBound);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "StyleVariant_styleBound", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_aux);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbType_aux", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_cop);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbType_cop", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_mod);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbType_mod", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
{
PyObject* wrapped = __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(__pyx_e_5spacy_10morphology_VerbType_light);
if (unlikely(!wrapped)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "VerbType_light", wrapped) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
if (__pyx_m) {
if (__pyx_d) {
__Pyx_AddTraceback("init spacy.morphology", __pyx_clineno, __pyx_lineno, __pyx_filename);
}
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init spacy.morphology");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* --- Runtime support code --- */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
if (unlikely(!result)) {
PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
"name '%U' is not defined", name);
#else
"name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
}
return result;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
if (is_list || PyList_CheckExact(o)) {
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
PyObject *r = PyList_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
}
else if (PyTuple_CheckExact(o)) {
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
} else {
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (likely(l >= 0)) {
i += l;
} else {
if (PyErr_ExceptionMatches(PyExc_OverflowError))
PyErr_Clear();
else
return NULL;
}
}
return m->sq_item(o, i);
}
}
#else
if (is_list || PySequence_Check(o)) {
return PySequence_GetItem(o, i);
}
#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
PyObject *result;
ternaryfunc call = func->ob_type->tp_call;
if (unlikely(!call))
return PyObject_Call(func, arg, kw);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = (*call)(func, arg, kw);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
PyObject *self, *result;
PyCFunction cfunc;
cfunc = PyCFunction_GET_FUNCTION(func);
self = PyCFunction_GET_SELF(func);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = cfunc(self, arg);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject *result;
PyObject *args = PyTuple_New(1);
if (unlikely(!args)) return NULL;
Py_INCREF(arg);
PyTuple_SET_ITEM(args, 0, arg);
result = __Pyx_PyObject_Call(func, args, NULL);
Py_DECREF(args);
return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
if (likely(PyCFunction_Check(func))) {
#endif
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
return __Pyx_PyObject_CallMethO(func, arg);
}
}
return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject *result;
PyObject *args = PyTuple_Pack(1, arg);
if (unlikely(!args)) return NULL;
result = __Pyx_PyObject_Call(func, args, NULL);
Py_DECREF(args);
return result;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
if (likely(PyCFunction_Check(func))) {
#endif
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
return __Pyx_PyObject_CallMethO(func, NULL);
}
}
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
index, (index == 1) ? "" : "s");
}
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
PyObject* exc_type = tstate->curexc_type;
if (unlikely(exc_type)) {
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
PyObject *exc_value, *exc_tb;
exc_value = tstate->curexc_value;
exc_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
Py_DECREF(exc_type);
Py_XDECREF(exc_value);
Py_XDECREF(exc_tb);
return 0;
} else {
return -1;
}
}
return 0;
#else
if (unlikely(PyErr_Occurred())) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
#endif
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else {
return __Pyx_IterFinish();
}
return 0;
}
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
result = PyDict_GetItem(__pyx_d, name);
if (likely(result)) {
Py_INCREF(result);
} else {
#else
result = PyObject_GetItem(__pyx_d, name);
if (!result) {
PyErr_Clear();
#endif
result = __Pyx_GetBuiltinName(name);
}
return result;
}
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
return PyObject_RichCompareBool(s1, s2, equals);
#else
if (s1 == s2) {
return (equals == Py_EQ);
} else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
const char *ps1, *ps2;
Py_ssize_t length = PyBytes_GET_SIZE(s1);
if (length != PyBytes_GET_SIZE(s2))
return (equals == Py_NE);
ps1 = PyBytes_AS_STRING(s1);
ps2 = PyBytes_AS_STRING(s2);
if (ps1[0] != ps2[0]) {
return (equals == Py_NE);
} else if (length == 1) {
return (equals == Py_EQ);
} else {
int result = memcmp(ps1, ps2, (size_t)length);
return (equals == Py_EQ) ? (result == 0) : (result != 0);
}
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
return (equals == Py_NE);
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
return (equals == Py_NE);
} else {
int result;
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
if (!py_result)
return -1;
result = __Pyx_PyObject_IsTrue(py_result);
Py_DECREF(py_result);
return result;
}
#endif
}
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
PyObject* owned_ref = NULL;
#endif
int s1_is_unicode, s2_is_unicode;
if (s1 == s2) {
goto return_eq;
}
s1_is_unicode = PyUnicode_CheckExact(s1);
s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
owned_ref = PyUnicode_FromObject(s2);
if (unlikely(!owned_ref))
return -1;
s2 = owned_ref;
s2_is_unicode = 1;
} else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
owned_ref = PyUnicode_FromObject(s1);
if (unlikely(!owned_ref))
return -1;
s1 = owned_ref;
s1_is_unicode = 1;
} else if (((!s2_is_unicode) & (!s1_is_unicode))) {
return __Pyx_PyBytes_Equals(s1, s2, equals);
}
#endif
if (s1_is_unicode & s2_is_unicode) {
Py_ssize_t length;
int kind;
void *data1, *data2;
if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
return -1;
length = __Pyx_PyUnicode_GET_LENGTH(s1);
if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
goto return_ne;
}
kind = __Pyx_PyUnicode_KIND(s1);
if (kind != __Pyx_PyUnicode_KIND(s2)) {
goto return_ne;
}
data1 = __Pyx_PyUnicode_DATA(s1);
data2 = __Pyx_PyUnicode_DATA(s2);
if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
goto return_ne;
} else if (length == 1) {
goto return_eq;
} else {
int result = memcmp(data1, data2, (size_t)(length * kind));
#if PY_MAJOR_VERSION < 3
Py_XDECREF(owned_ref);
#endif
return (equals == Py_EQ) ? (result == 0) : (result != 0);
}
} else if ((s1 == Py_None) & s2_is_unicode) {
goto return_ne;
} else if ((s2 == Py_None) & s1_is_unicode) {
goto return_ne;
} else {
int result;
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
if (!py_result)
return -1;
result = __Pyx_PyObject_IsTrue(py_result);
Py_DECREF(py_result);
return result;
}
return_eq:
#if PY_MAJOR_VERSION < 3
Py_XDECREF(owned_ref);
#endif
return (equals == Py_EQ);
return_ne:
#if PY_MAJOR_VERSION < 3
Py_XDECREF(owned_ref);
#endif
return (equals == Py_NE);
#endif
}
static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
Py_ssize_t num_min,
Py_ssize_t num_max,
Py_ssize_t num_found)
{
Py_ssize_t num_expected;
const char *more_or_less;
if (num_found < num_min) {
num_expected = num_min;
more_or_less = "at least";
} else {
num_expected = num_max;
more_or_less = "at most";
}
if (exact) {
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
{
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION >= 3
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
#else
"%s() got multiple values for keyword argument '%s'", func_name,
PyString_AsString(kw_name));
#endif
}
static int __Pyx_ParseOptionalKeywords(
PyObject *kwds,
PyObject **argnames[],
PyObject *kwds2,
PyObject *values[],
Py_ssize_t num_pos_args,
const char* function_name)
{
PyObject *key = 0, *value = 0;
Py_ssize_t pos = 0;
PyObject*** name;
PyObject*** first_kw_arg = argnames + num_pos_args;
while (PyDict_Next(kwds, &pos, &key, &value)) {
name = first_kw_arg;
while (*name && (**name != key)) name++;
if (*name) {
values[name-argnames] = value;
continue;
}
name = first_kw_arg;
#if PY_MAJOR_VERSION < 3
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
while (*name) {
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
&& _PyString_Eq(**name, key)) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
if ((**argname == key) || (
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
&& _PyString_Eq(**argname, key))) {
goto arg_passed_twice;
}
argname++;
}
}
} else
#endif
if (likely(PyUnicode_Check(key))) {
while (*name) {
int cmp = (**name == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**name, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
int cmp = (**argname == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**argname, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) goto arg_passed_twice;
argname++;
}
}
} else
goto invalid_keyword_type;
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, key);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%.200s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
PyErr_Format(PyExc_TypeError,
"Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact)
{
if (unlikely(!type)) {
PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
if (likely(Py_TYPE(obj) == type)) return 1;
#if PY_MAJOR_VERSION == 2
else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
#endif
}
else {
if (likely(PyObject_TypeCheck(obj, type))) return 1;
}
__Pyx_RaiseArgumentTypeInvalid(name, obj, type);
return 0;
}
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(op1))) {
const long b = intval;
long x;
long a = PyInt_AS_LONG(op1);
x = (long)((unsigned long)a + b);
if (likely((x^a) >= 0 || (x^b) >= 0))
return PyInt_FromLong(x);
return PyLong_Type.tp_as_number->nb_add(op1, op2);
}
#endif
#if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
if (likely(PyLong_CheckExact(op1))) {
const long b = intval;
long a, x;
const PY_LONG_LONG llb = intval;
PY_LONG_LONG lla, llx;
const digit* digits = ((PyLongObject*)op1)->ob_digit;
const Py_ssize_t size = Py_SIZE(op1);
if (likely(__Pyx_sst_abs(size) <= 1)) {
a = likely(size) ? digits[0] : 0;
if (size == -1) a = -a;
} else {
switch (size) {
case -2:
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
}
case 2:
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
}
case -3:
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
}
case 3:
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
}
case -4:
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
}
case 4:
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
}
default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
}
}
x = a + b;
return PyLong_FromLong(x);
long_long:
llx = lla + llb;
return PyLong_FromLongLong(llx);
}
#endif
if (PyFloat_CheckExact(op1)) {
const long b = intval;
double a = PyFloat_AS_DOUBLE(op1);
double result;
PyFPE_START_PROTECT("add", return NULL)
result = ((double)a) + (double)b;
PyFPE_END_PROTECT(result)
return PyFloat_FromDouble(result);
}
return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
int r;
if (!j) return -1;
r = PyObject_SetItem(o, j, v);
Py_DECREF(j);
return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
if (is_list || PyList_CheckExact(o)) {
Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
PyObject* old = PyList_GET_ITEM(o, n);
Py_INCREF(v);
PyList_SET_ITEM(o, n, v);
Py_DECREF(old);
return 1;
}
} else {
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_ass_item)) {
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (likely(l >= 0)) {
i += l;
} else {
if (PyErr_ExceptionMatches(PyExc_OverflowError))
PyErr_Clear();
else
return -1;
}
}
return m->sq_ass_item(o, i, v);
}
}
#else
#if CYTHON_COMPILING_IN_PYPY
if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
if (is_list || PySequence_Check(o)) {
#endif
return PySequence_SetItem(o, i, v);
}
#endif
return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->curexc_type;
tmp_value = tstate->curexc_value;
tmp_tb = tstate->curexc_traceback;
tstate->curexc_type = type;
tstate->curexc_value = value;
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->curexc_type;
*value = tstate->curexc_value;
*tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
#else
PyErr_Fetch(type, value, tb);
#endif
}
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
CYTHON_UNUSED PyObject *cause) {
Py_XINCREF(type);
if (!value || value == Py_None)
value = NULL;
else
Py_INCREF(value);
if (!tb || tb == Py_None)
tb = NULL;
else {
Py_INCREF(tb);
if (!PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
}
if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
value = Py_None;
}
#endif
PyErr_NormalizeException(&type, &value, &tb);
} else {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
value = type;
type = (PyObject*) Py_TYPE(type);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
}
__Pyx_ErrRestore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
tb = 0;
} else if (tb && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto bad;
}
if (value == Py_None)
value = 0;
if (PyExceptionInstance_Check(type)) {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto bad;
}
value = type;
type = (PyObject*) Py_TYPE(value);
} else if (PyExceptionClass_Check(type)) {
PyObject *instance_class = NULL;
if (value && PyExceptionInstance_Check(value)) {
instance_class = (PyObject*) Py_TYPE(value);
if (instance_class != type) {
int is_subclass = PyObject_IsSubclass(instance_class, type);
if (!is_subclass) {
instance_class = NULL;
} else if (unlikely(is_subclass == -1)) {
goto bad;
} else {
type = instance_class;
}
}
}
if (!instance_class) {
PyObject *args;
if (!value)
args = PyTuple_New(0);
else if (PyTuple_Check(value)) {
Py_INCREF(value);
args = value;
} else
args = PyTuple_Pack(1, value);
if (!args)
goto bad;
owned_instance = PyObject_Call(type, args, NULL);
Py_DECREF(args);
if (!owned_instance)
goto bad;
value = owned_instance;
if (!PyExceptionInstance_Check(value)) {
PyErr_Format(PyExc_TypeError,
"calling %R should have returned an instance of "
"BaseException, not %R",
type, Py_TYPE(value));
goto bad;
}
}
} else {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto bad;
}
#if PY_VERSION_HEX >= 0x03030000
if (cause) {
#else
if (cause && cause != Py_None) {
#endif
PyObject *fixed_cause;
if (cause == Py_None) {
fixed_cause = NULL;
} else if (PyExceptionClass_Check(cause)) {
fixed_cause = PyObject_CallObject(cause, NULL);
if (fixed_cause == NULL)
goto bad;
} else if (PyExceptionInstance_Check(cause)) {
fixed_cause = cause;
Py_INCREF(fixed_cause);
} else {
PyErr_SetString(PyExc_TypeError,
"exception causes must derive from "
"BaseException");
goto bad;
}
PyException_SetCause(value, fixed_cause);
}
PyErr_SetObject(type, value);
if (tb) {
#if CYTHON_COMPILING_IN_PYPY
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
Py_INCREF(tb);
PyErr_Restore(tmp_type, tmp_value, tb);
Py_XDECREF(tmp_tb);
#else
PyThreadState *tstate = PyThreadState_GET();
PyObject* tmp_tb = tstate->curexc_traceback;
if (tb != tmp_tb) {
Py_INCREF(tb);
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_tb);
}
#endif
}
bad:
Py_XDECREF(owned_instance);
return;
}
#endif
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
PyObject *method;
method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
if (unlikely(!method))
return -1;
target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_MAJOR_VERSION >= 3
if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type)))
#endif
{
PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
target->func = descr->d_method->ml_meth;
target->flag = descr->d_method->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_O | METH_NOARGS);
}
#endif
return 0;
}
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
PyObject *args, *result = NULL;
if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
args = PyTuple_New(1);
if (unlikely(!args)) goto bad;
Py_INCREF(self);
PyTuple_SET_ITEM(args, 0, self);
#else
args = PyTuple_Pack(1, self);
if (unlikely(!args)) goto bad;
#endif
result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
Py_DECREF(args);
bad:
return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
if (PY_MAJOR_VERSION >= 3)
return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
else
return PyDict_Items(d);
}
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (unlikely(!type)) {
PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
if (likely(PyObject_TypeCheck(obj, type)))
return 1;
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
Py_TYPE(obj)->tp_name, type->tp_name);
return 0;
}
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
if (!ob)
goto bad;
if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
goto bad;
Py_DECREF(ob);
return 0;
bad:
Py_XDECREF(ob);
return -1;
}
static void* __Pyx_GetVtable(PyObject *dict) {
void* ptr;
PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
if (!ob)
goto bad;
#if PY_VERSION_HEX >= 0x02070000
ptr = PyCapsule_GetPointer(ob, 0);
#else
ptr = PyCObject_AsVoidPtr(ob);
#endif
if (!ptr && !PyErr_Occurred())
PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
Py_DECREF(ob);
return ptr;
bad:
Py_XDECREF(ob);
return NULL;
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
#if PY_VERSION_HEX < 0x03030000
PyObject *py_import;
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
if (!py_import)
goto bad;
#endif
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
{
#if PY_MAJOR_VERSION >= 3
if (level == -1) {
if (strchr(__Pyx_MODULE_NAME, '.')) {
#if PY_VERSION_HEX < 0x03030000
PyObject *py_level = PyInt_FromLong(1);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
#else
module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, 1);
#endif
if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad;
PyErr_Clear();
}
}
level = 0;
}
#endif
if (!module) {
#if PY_VERSION_HEX < 0x03030000
PyObject *py_level = PyInt_FromLong(level);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
#else
module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, level);
#endif
}
}
bad:
#if PY_VERSION_HEX < 0x03030000
Py_XDECREF(py_import);
#endif
Py_XDECREF(empty_list);
Py_XDECREF(empty_dict);
return module;
}
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_Format(PyExc_ImportError,
#if PY_MAJOR_VERSION < 3
"cannot import name %.230s", PyString_AS_STRING(name));
#else
"cannot import name %S", name);
#endif
}
return value;
}
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
PyObject* fake_module;
PyTypeObject* cached_type = NULL;
fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
if (!fake_module) return NULL;
Py_INCREF(fake_module);
cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
if (cached_type) {
if (!PyType_Check((PyObject*)cached_type)) {
PyErr_Format(PyExc_TypeError,
"Shared Cython type %.200s is not a type object",
type->tp_name);
goto bad;
}
if (cached_type->tp_basicsize != type->tp_basicsize) {
PyErr_Format(PyExc_TypeError,
"Shared Cython type %.200s has the wrong size, try recompiling",
type->tp_name);
goto bad;
}
} else {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
PyErr_Clear();
if (PyType_Ready(type) < 0) goto bad;
if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
goto bad;
Py_INCREF(type);
cached_type = type;
}
done:
Py_DECREF(fake_module);
return cached_type;
bad:
Py_XDECREF(cached_type);
cached_type = NULL;
goto done;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
if (unlikely(op->func_doc == NULL)) {
if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
if (unlikely(op->func_doc == NULL))
return NULL;
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
Py_INCREF(op->func_doc);
return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp = op->func_doc;
if (value == NULL) {
value = Py_None;
}
Py_INCREF(value);
op->func_doc = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
if (unlikely(op->func_name == NULL))
return NULL;
}
Py_INCREF(op->func_name);
return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
PyErr_SetString(PyExc_TypeError,
"__name__ must be set to a string object");
return -1;
}
tmp = op->func_name;
Py_INCREF(value);
op->func_name = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
Py_INCREF(op->func_qualname);
return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
PyErr_SetString(PyExc_TypeError,
"__qualname__ must be set to a string object");
return -1;
}
tmp = op->func_qualname;
Py_INCREF(value);
op->func_qualname = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
PyObject *self;
self = m->func_closure;
if (self == NULL)
self = Py_None;
Py_INCREF(self);
return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
if (unlikely(op->func_dict == NULL)) {
op->func_dict = PyDict_New();
if (unlikely(op->func_dict == NULL))
return NULL;
}
Py_INCREF(op->func_dict);
return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
if (unlikely(value == NULL)) {
PyErr_SetString(PyExc_TypeError,
"function's dictionary may not be deleted");
return -1;
}
if (unlikely(!PyDict_Check(value))) {
PyErr_SetString(PyExc_TypeError,
"setting function's dictionary to a non-dict");
return -1;
}
tmp = op->func_dict;
Py_INCREF(value);
op->func_dict = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
Py_INCREF(op->func_globals);
return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
PyObject* result = (op->func_code) ? op->func_code : Py_None;
Py_INCREF(result);
return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
int result = 0;
PyObject *res = op->defaults_getter((PyObject *) op);
if (unlikely(!res))
return -1;
#if CYTHON_COMPILING_IN_CPYTHON
op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
Py_INCREF(op->defaults_tuple);
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
Py_INCREF(op->defaults_kwdict);
#else
op->defaults_tuple = PySequence_ITEM(res, 0);
if (unlikely(!op->defaults_tuple)) result = -1;
else {
op->defaults_kwdict = PySequence_ITEM(res, 1);
if (unlikely(!op->defaults_kwdict)) result = -1;
}
#endif
Py_DECREF(res);
return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
PyObject* tmp;
if (!value) {
value = Py_None;
} else if (value != Py_None && !PyTuple_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"__defaults__ must be set to a tuple object");
return -1;
}
Py_INCREF(value);
tmp = op->defaults_tuple;
op->defaults_tuple = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
PyObject* result = op->defaults_tuple;
if (unlikely(!result)) {
if (op->defaults_getter) {
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
result = op->defaults_tuple;
} else {
result = Py_None;
}
}
Py_INCREF(result);
return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
PyObject* tmp;
if (!value) {
value = Py_None;
} else if (value != Py_None && !PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"__kwdefaults__ must be set to a dict object");
return -1;
}
Py_INCREF(value);
tmp = op->defaults_kwdict;
op->defaults_kwdict = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
PyObject* result = op->defaults_kwdict;
if (unlikely(!result)) {
if (op->defaults_getter) {
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
result = op->defaults_kwdict;
} else {
result = Py_None;
}
}
Py_INCREF(result);
return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
PyObject* tmp;
if (!value || value == Py_None) {
value = NULL;
} else if (!PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"__annotations__ must be set to a dict object");
return -1;
}
Py_XINCREF(value);
tmp = op->func_annotations;
op->func_annotations = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
PyObject* result = op->func_annotations;
if (unlikely(!result)) {
result = PyDict_New();
if (unlikely(!result)) return NULL;
op->func_annotations = result;
}
Py_INCREF(result);
return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
{(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
{0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
{0, 0, 0, 0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
__Pyx_CyFunction_weakreflist(op) = NULL;
op->func.m_ml = ml;
op->func.m_self = (PyObject *) op;
Py_XINCREF(closure);
op->func_closure = closure;
Py_XINCREF(module);
op->func.m_module = module;
op->func_dict = NULL;
op->func_name = NULL;
Py_INCREF(qualname);
op->func_qualname = qualname;
op->func_doc = NULL;
op->func_classobj = NULL;
op->func_globals = globals;
Py_INCREF(op->func_globals);
Py_XINCREF(code);
op->func_code = code;
op->defaults_pyobjects = 0;
op->defaults = NULL;
op->defaults_tuple = NULL;
op->defaults_kwdict = NULL;
op->defaults_getter = NULL;
op->func_annotations = NULL;
PyObject_GC_Track(op);
return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
Py_CLEAR(m->func_closure);
Py_CLEAR(m->func.m_module);
Py_CLEAR(m->func_dict);
Py_CLEAR(m->func_name);
Py_CLEAR(m->func_qualname);
Py_CLEAR(m->func_doc);
Py_CLEAR(m->func_globals);
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
Py_CLEAR(m->defaults_kwdict);
Py_CLEAR(m->func_annotations);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_XDECREF(pydefaults[i]);
PyMem_Free(m->defaults);
m->defaults = NULL;
}
return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
if (__Pyx_CyFunction_weakreflist(m) != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
Py_VISIT(m->func_closure);
Py_VISIT(m->func.m_module);
Py_VISIT(m->func_dict);
Py_VISIT(m->func_name);
Py_VISIT(m->func_qualname);
Py_VISIT(m->func_doc);
Py_VISIT(m->func_globals);
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
Py_VISIT(m->defaults_kwdict);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_VISIT(pydefaults[i]);
}
return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
Py_INCREF(func);
return func;
}
if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
if (type == NULL)
type = (PyObject *)(Py_TYPE(obj));
return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
}
if (obj == Py_None)
obj = NULL;
return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromFormat("<cyfunction %U at %p>",
op->func_qualname, (void *)op);
#else
return PyString_FromFormat("<cyfunction %s at %p>",
PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
PyCFunctionObject* f = (PyCFunctionObject*)func;
PyCFunction meth = f->m_ml->ml_meth;
PyObject *self = f->m_self;
Py_ssize_t size;
switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
case METH_VARARGS:
if (likely(kw == NULL || PyDict_Size(kw) == 0))
return (*meth)(self, arg);
break;
case METH_VARARGS | METH_KEYWORDS:
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
case METH_NOARGS:
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
size = PyTuple_GET_SIZE(arg);
if (likely(size == 0))
return (*meth)(self, NULL);
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
f->m_ml->ml_name, size);
return NULL;
}
break;
case METH_O:
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
size = PyTuple_GET_SIZE(arg);
if (likely(size == 1)) {
PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0)) return NULL;
result = (*meth)(self, arg0);
Py_DECREF(arg0);
return result;
}
PyErr_Format(PyExc_TypeError,
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
f->m_ml->ml_name, size);
return NULL;
}
break;
default:
PyErr_SetString(PyExc_SystemError, "Bad call flags in "
"__Pyx_CyFunction_Call. METH_OLDARGS is no "
"longer supported!");
return NULL;
}
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
f->m_ml->ml_name);
return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
"cython_function_or_method",
sizeof(__pyx_CyFunctionObject),
0,
(destructor) __Pyx_CyFunction_dealloc,
0,
0,
0,
#if PY_MAJOR_VERSION < 3
0,
#else
0,
#endif
(reprfunc) __Pyx_CyFunction_repr,
0,
0,
0,
0,
__Pyx_CyFunction_Call,
0,
0,
0,
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
0,
(traverseproc) __Pyx_CyFunction_traverse,
(inquiry) __Pyx_CyFunction_clear,
0,
#if PY_VERSION_HEX < 0x030500A0
offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
offsetof(PyCFunctionObject, m_weakreflist),
#endif
0,
0,
__pyx_CyFunction_methods,
__pyx_CyFunction_members,
__pyx_CyFunction_getsets,
0,
0,
__Pyx_CyFunction_descr_get,
0,
offsetof(__pyx_CyFunctionObject, func_dict),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
#if PY_VERSION_HEX >= 0x030400a1
0,
#endif
};
static int __pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
__pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
if (__pyx_CyFunctionType == NULL) {
return -1;
}
return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults = PyMem_Malloc(size);
if (!m->defaults)
return PyErr_NoMemory();
memset(m->defaults, 0, size);
m->defaults_pyobjects = pyobjects;
return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_tuple = tuple;
Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_kwdict = dict;
Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->func_annotations = dict;
Py_INCREF(dict);
}
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
int start = 0, mid = 0, end = count - 1;
if (end >= 0 && code_line > entries[end].code_line) {
return count;
}
while (start < end) {
mid = start + (end - start) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0,
0,
0,
0,
0,
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line,
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
__pyx_d, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
{\
func_type value = func_value;\
if (sizeof(target_type) < sizeof(func_type)) {\
if (unlikely(value != (func_type) (target_type) value)) {\
func_type zero = 0;\
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
return (target_type) -1;\
if (is_unsigned && unlikely(value < zero))\
goto raise_neg_overflow;\
else\
goto raise_overflow;\
}\
}\
return (target_type) value;\
}
static CYTHON_INLINE enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __Pyx_PyInt_As_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PyObject *x) {
const enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t neg_one = (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1, const_zero = (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, digit, digits[0])
case 2:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) >= 2 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) (((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) >= 3 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) (((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) >= 4 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) (((((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, digit, +digits[0])
case -2:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 2 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) (((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)-1)*(((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 2 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) ((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 3 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) (((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)-1)*(((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 3 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) ((((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 4 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) (((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)-1)*(((((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) - 1 > 4 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) ((((((((((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, long, PyLong_AsLong(x))
} else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1;
}
} else {
enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1;
val = __Pyx_PyInt_As_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t");
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t");
return (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1;
}
static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(int32_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (int32_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (int32_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0])
case 2:
if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) {
return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) {
return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) >= 4 * PyLong_SHIFT) {
return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (int32_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(int32_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (int32_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, +digits[0])
case -2:
if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) {
return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) {
return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(int32_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
} else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
int32_t val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (int32_t) -1;
}
} else {
int32_t val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (int32_t) -1;
val = __Pyx_PyInt_As_int32_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to int32_t");
return (int32_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to int32_t");
return (int32_t) -1;
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5spacy_10morphology_univ_morph_t(enum __pyx_t_5spacy_10morphology_univ_morph_t value) {
const enum __pyx_t_5spacy_10morphology_univ_morph_t neg_one = (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1, const_zero = (enum __pyx_t_5spacy_10morphology_univ_morph_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t),
little, !is_unsigned);
}
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value) {
const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t),
little, !is_unsigned);
}
}
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(size_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (size_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (size_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
case 2:
if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (size_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(size_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (size_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
case -2:
if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(size_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
} else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
size_t val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (size_t) -1;
}
} else {
size_t val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (size_t) -1;
val = __Pyx_PyInt_As_size_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to size_t");
return (size_t) -1;
}
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
const int neg_one = (int) -1, const_zero = (int) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(int) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (int) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (int) 0;
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
case 2:
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (int) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(int) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (int) 0;
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
case -2:
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
}
#endif
if (sizeof(int) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
int val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (int) -1;
}
} else {
int val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (int) -1;
val = __Pyx_PyInt_As_int(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to int");
return (int) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to int");
return (int) -1;
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(int32_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(int32_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(int32_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(int32_t),
little, !is_unsigned);
}
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
const int neg_one = (int) -1, const_zero = (int) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(int) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(int) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(int) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(int),
little, !is_unsigned);
}
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t value) {
const enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t neg_one = (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1, const_zero = (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t),
little, !is_unsigned);
}
}
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(uint64_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (uint64_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint64_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
case 2:
if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (uint64_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(uint64_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint64_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0])
case -2:
if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(uint64_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
} else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
uint64_t val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (uint64_t) -1;
}
} else {
uint64_t val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (uint64_t) -1;
val = __Pyx_PyInt_As_uint64_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to uint64_t");
return (uint64_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to uint64_t");
return (uint64_t) -1;
}
static CYTHON_INLINE enum __pyx_t_5spacy_10morphology_univ_morph_t __Pyx_PyInt_As_enum____pyx_t_5spacy_10morphology_univ_morph_t(PyObject *x) {
const enum __pyx_t_5spacy_10morphology_univ_morph_t neg_one = (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1, const_zero = (enum __pyx_t_5spacy_10morphology_univ_morph_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (enum __pyx_t_5spacy_10morphology_univ_morph_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, digit, digits[0])
case 2:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) >= 2 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) (((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) >= 3 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) (((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) >= 4 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) (((((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (enum __pyx_t_5spacy_10morphology_univ_morph_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, digit, +digits[0])
case -2:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 2 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) (((enum __pyx_t_5spacy_10morphology_univ_morph_t)-1)*(((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 2 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) ((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 3 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) (((enum __pyx_t_5spacy_10morphology_univ_morph_t)-1)*(((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 3 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) ((((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 4 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) (((enum __pyx_t_5spacy_10morphology_univ_morph_t)-1)*(((((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_10morphology_univ_morph_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) - 1 > 4 * PyLong_SHIFT) {
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) ((((((((((enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_10morphology_univ_morph_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_10morphology_univ_morph_t, long, PyLong_AsLong(x))
} else if (sizeof(enum __pyx_t_5spacy_10morphology_univ_morph_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_10morphology_univ_morph_t, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
enum __pyx_t_5spacy_10morphology_univ_morph_t val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1;
}
} else {
enum __pyx_t_5spacy_10morphology_univ_morph_t val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1;
val = __Pyx_PyInt_As_enum____pyx_t_5spacy_10morphology_univ_morph_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to enum __pyx_t_5spacy_10morphology_univ_morph_t");
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to enum __pyx_t_5spacy_10morphology_univ_morph_t");
return (enum __pyx_t_5spacy_10morphology_univ_morph_t) -1;
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
const long neg_one = (long) -1, const_zero = (long) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(long) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(long) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(long) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(long),
little, !is_unsigned);
}
}
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
return ::std::complex< float >(x, y);
}
#else
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
return x + y*(__pyx_t_float_complex)_Complex_I;
}
#endif
#else
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
__pyx_t_float_complex z;
z.real = x;
z.imag = y;
return z;
}
#endif
#if CYTHON_CCOMPLEX
#else
static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
return (a.real == b.real) && (a.imag == b.imag);
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
z.real = a.real + b.real;
z.imag = a.imag + b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
z.real = a.real - b.real;
z.imag = a.imag - b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
z.real = a.real * b.real - a.imag * b.imag;
z.imag = a.real * b.imag + a.imag * b.real;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
float denom = b.real * b.real + b.imag * b.imag;
z.real = (a.real * b.real + a.imag * b.imag) / denom;
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
__pyx_t_float_complex z;
z.real = -a.real;
z.imag = -a.imag;
return z;
}
static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
return (a.real == 0) && (a.imag == 0);
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
__pyx_t_float_complex z;
z.real = a.real;
z.imag = -a.imag;
return z;
}
#if 1
static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
return sqrtf(z.real*z.real + z.imag*z.imag);
#else
return hypotf(z.real, z.imag);
#endif
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
float r, lnr, theta, z_r, z_theta;
if (b.imag == 0 && b.real == (int)b.real) {
if (b.real < 0) {
float denom = a.real * a.real + a.imag * a.imag;
a.real = a.real / denom;
a.imag = -a.imag / denom;
b.real = -b.real;
}
switch ((int)b.real) {
case 0:
z.real = 1;
z.imag = 0;
return z;
case 1:
return a;
case 2:
z = __Pyx_c_prodf(a, a);
return __Pyx_c_prodf(a, a);
case 3:
z = __Pyx_c_prodf(a, a);
return __Pyx_c_prodf(z, a);
case 4:
z = __Pyx_c_prodf(a, a);
return __Pyx_c_prodf(z, z);
}
}
if (a.imag == 0) {
if (a.real == 0) {
return a;
}
r = a.real;
theta = 0;
} else {
r = __Pyx_c_absf(a);
theta = atan2f(a.imag, a.real);
}
lnr = logf(r);
z_r = expf(lnr * b.real - theta * b.imag);
z_theta = theta * b.real + lnr * b.imag;
z.real = z_r * cosf(z_theta);
z.imag = z_r * sinf(z_theta);
return z;
}
#endif
#endif
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
return ::std::complex< double >(x, y);
}
#else
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
return x + y*(__pyx_t_double_complex)_Complex_I;
}
#endif
#else
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
__pyx_t_double_complex z;
z.real = x;
z.imag = y;
return z;
}
#endif
#if CYTHON_CCOMPLEX
#else
static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
return (a.real == b.real) && (a.imag == b.imag);
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
z.real = a.real + b.real;
z.imag = a.imag + b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
z.real = a.real - b.real;
z.imag = a.imag - b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
z.real = a.real * b.real - a.imag * b.imag;
z.imag = a.real * b.imag + a.imag * b.real;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
double denom = b.real * b.real + b.imag * b.imag;
z.real = (a.real * b.real + a.imag * b.imag) / denom;
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
__pyx_t_double_complex z;
z.real = -a.real;
z.imag = -a.imag;
return z;
}
static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
return (a.real == 0) && (a.imag == 0);
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
__pyx_t_double_complex z;
z.real = a.real;
z.imag = -a.imag;
return z;
}
#if 1
static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
return sqrt(z.real*z.real + z.imag*z.imag);
#else
return hypot(z.real, z.imag);
#endif
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
double r, lnr, theta, z_r, z_theta;
if (b.imag == 0 && b.real == (int)b.real) {
if (b.real < 0) {
double denom = a.real * a.real + a.imag * a.imag;
a.real = a.real / denom;
a.imag = -a.imag / denom;
b.real = -b.real;
}
switch ((int)b.real) {
case 0:
z.real = 1;
z.imag = 0;
return z;
case 1:
return a;
case 2:
z = __Pyx_c_prod(a, a);
return __Pyx_c_prod(a, a);
case 3:
z = __Pyx_c_prod(a, a);
return __Pyx_c_prod(z, a);
case 4:
z = __Pyx_c_prod(a, a);
return __Pyx_c_prod(z, z);
}
}
if (a.imag == 0) {
if (a.real == 0) {
return a;
}
r = a.real;
theta = 0;
} else {
r = __Pyx_c_abs(a);
theta = atan2(a.imag, a.real);
}
lnr = log(r);
z_r = exp(lnr * b.real - theta * b.imag);
z_theta = theta * b.real + lnr * b.imag;
z.real = z_r * cos(z_theta);
z.imag = z_r * sin(z_theta);
return z;
}
#endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(enum NPY_TYPES) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
}
} else {
if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
little, !is_unsigned);
}
}
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
const long neg_one = (long) -1, const_zero = (long) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(long) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (long) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (long) 0;
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
case 2:
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (long) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(long) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (long) 0;
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
case -2:
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
}
#endif
if (sizeof(long) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
long val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (long) -1;
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long) -1;
val = __Pyx_PyInt_As_long(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to long");
return (long) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long) -1;
}
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
return PyErr_WarnEx(NULL, message, 1);
}
return 0;
}
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = __Pyx_PyIdentifier_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
size_t size, int strict)
{
PyObject *py_module = 0;
PyObject *result = 0;
PyObject *py_name = 0;
char warning[200];
Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
PyObject *py_basicsize;
#endif
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
py_name = __Pyx_PyIdentifier_FromString(class_name);
if (!py_name)
goto bad;
result = PyObject_GetAttr(py_module, py_name);
Py_DECREF(py_name);
py_name = 0;
Py_DECREF(py_module);
py_module = 0;
if (!result)
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
"%.200s.%.200s is not a type object",
module_name, class_name);
goto bad;
}
#ifndef Py_LIMITED_API
basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
if (!py_basicsize)
goto bad;
basicsize = PyLong_AsSsize_t(py_basicsize);
Py_DECREF(py_basicsize);
py_basicsize = 0;
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
goto bad;
#endif
if (!strict && (size_t)basicsize > size) {
PyOS_snprintf(warning, sizeof(warning),
"%s.%s size changed, may indicate binary incompatibility",
module_name, class_name);
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
}
else if ((size_t)basicsize != size) {
PyErr_Format(PyExc_ValueError,
"%.200s.%.200s has the wrong size, try recompiling",
module_name, class_name);
goto bad;
}
return (PyTypeObject *)result;
bad:
Py_XDECREF(py_module);
Py_XDECREF(result);
return NULL;
}
#endif
#ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
PyObject *d = 0;
PyObject *cobj = 0;
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
if (!d)
goto bad;
cobj = PyDict_GetItemString(d, name);
if (!cobj) {
PyErr_Format(PyExc_ImportError,
"%.200s does not export expected C variable %.200s",
PyModule_GetName(module), name);
goto bad;
}
#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
PyErr_Format(PyExc_TypeError,
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
goto bad;
}
*p = PyCapsule_GetPointer(cobj, sig);
#else
{const char *desc, *s1, *s2;
desc = (const char *)PyCObject_GetDesc(cobj);
if (!desc)
goto bad;
s1 = desc; s2 = sig;
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
if (*s1 != *s2) {
PyErr_Format(PyExc_TypeError,
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), name, sig, desc);
goto bad;
}
*p = PyCObject_AsVoidPtr(cobj);}
#endif
if (!(*p))
goto bad;
Py_DECREF(d);
return 0;
bad:
Py_XDECREF(d);
return -1;
}
#endif
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
PyObject *d = 0;
PyObject *cobj = 0;
union {
void (*fp)(void);
void *p;
} tmp;
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
if (!d)
goto bad;
cobj = PyDict_GetItemString(d, funcname);
if (!cobj) {
PyErr_Format(PyExc_ImportError,
"%.200s does not export expected C function %.200s",
PyModule_GetName(module), funcname);
goto bad;
}
#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
goto bad;
}
tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
{const char *desc, *s1, *s2;
desc = (const char *)PyCObject_GetDesc(cobj);
if (!desc)
goto bad;
s1 = desc; s2 = sig;
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
if (*s1 != *s2) {
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, desc);
goto bad;
}
tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
*f = tmp.fp;
if (!(*f))
goto bad;
Py_DECREF(d);
return 0;
bad:
Py_XDECREF(d);
return -1;
}
#endif
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
Py_ssize_t ignore;
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
__Pyx_sys_getdefaultencoding_not_ascii &&
#endif
PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
char* defenc_c;
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
if (!defenc) return NULL;
defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
{
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
char* c;
for (c = defenc_c; c < end; c++) {
if ((unsigned char) (*c) >= 128) {
PyUnicode_AsASCIIString(o);
return NULL;
}
}
}
#endif
*length = PyBytes_GET_SIZE(defenc);
return defenc_c;
#else
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if (PyUnicode_IS_ASCII(o)) {
*length = PyUnicode_GET_LENGTH(o);
return PyUnicode_AsUTF8(o);
} else {
PyUnicode_AsASCIIString(o);
return NULL;
}
#else
return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
} else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
if (PyByteArray_Check(o)) {
*length = PyByteArray_GET_SIZE(o);
return PyByteArray_AS_STRING(o);
} else
#endif
{
char* result;
int r = PyBytes_AsStringAndSize(o, &result, length);
if (unlikely(r < 0)) {
return NULL;
} else {
return result;
}
}
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return __Pyx_NewRef(x);
m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_MAJOR_VERSION < 3
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%.4s__ returned non-%.4s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject *x;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(b))) {
if (sizeof(Py_ssize_t) >= sizeof(long))
return PyInt_AS_LONG(b);
else
return PyInt_AsSsize_t(x);
}
#endif
if (likely(PyLong_CheckExact(b))) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)b)->ob_digit;
const Py_ssize_t size = Py_SIZE(b);
if (likely(__Pyx_sst_abs(size) <= 1)) {
ival = likely(size) ? digits[0] : 0;
if (size == -1) ival = -ival;
return ival;
} else {
switch (size) {
case 2:
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case -2:
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case 3:
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case -3:
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case 4:
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case -4:
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
}
}
#endif
return PyLong_AsSsize_t(b);
}
x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
return PyInt_FromSize_t(ival);
}
#endif /* Py_PYTHON_H */
| 50.152762
| 453
| 0.6855
|
gghilango
|
f44159cdcddc184168d8712f8655d535d8b60f73
| 2,299
|
cpp
|
C++
|
POJ/24 - 26/poj2424.cpp
|
bilibiliShen/CodeBank
|
49a69b2b2c3603bf105140a9d924946ed3193457
|
[
"MIT"
] | 1
|
2017-08-19T16:02:15.000Z
|
2017-08-19T16:02:15.000Z
|
POJ/24 - 26/poj2424.cpp
|
bilibiliShen/CodeBank
|
49a69b2b2c3603bf105140a9d924946ed3193457
|
[
"MIT"
] | null | null | null |
POJ/24 - 26/poj2424.cpp
|
bilibiliShen/CodeBank
|
49a69b2b2c3603bf105140a9d924946ed3193457
|
[
"MIT"
] | 1
|
2018-01-05T23:37:23.000Z
|
2018-01-05T23:37:23.000Z
|
/****
*@Polo-shen
*
*/
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
//#include <algorithm>
#include <cmath>
//#include <iomanip>
//#include <fstream>
//#include <cstdlib>
#include <vector>
//#include <list>
//#include <set>
//#include <map>
using namespace std;
typedef long long int64;
#define DBG 0
#define ALG 0
#if DBG
#include <cstdlib>
#define pause system("pause")
#define ShowLine cout<<__LINE__<<">|\t"
#define dout cout<<__LINE__<<">|\t"
#define write(x) #x" = "<<(x)<<" "
#define awrite(array,num) #array"["<<num<<"]="<<array[num]<<" "
#else
#define pause ;
#define ShowLine DBG && cout<<__LINE__<<">|\t"
#define dout DBG && cout<<__LINE__<<">|\t"
#define write(x) #x" = "<<(x)<<" "
#define awrite(array,num) #array"["<<num<<"]="<<array[num]<<" "
#endif // DBG
#if ALG
#include <algorithm>
#else
#ifndef min
#define min(x,y) ((x) < (y) ? (x) : (y))
#endif
#ifndef max
#define max(x,y) ((x) > (y) ? (x) : (y))
#endif
#endif // ALG
void sprint(string s){
if (DBG){
string::size_type sz=s.size();
for (int i=0;i<sz;i++){
printf("%c",s[i]);
}
puts("|< EOL >|\n");
}
else return;
}
/***
*Title:
*
*/
struct table{
int end[101];
int wait_time[101];
};
int main(){
int t[3],n,clock,minute,time,people;
char s[10];
while (1){
struct table tab[3];
int k[3]={1,1,1},sum= 0;
for(n=0;n<3;n++){
memset(tab[n].end,0,sizeof(tab[n].end));
memset(tab[n].wait_time, 0, sizeof(tab[n].wait_time));
}
cin>>t[0]>>t[1]>>t[2];
getchar(); // 消去回车。
if(t[0]==0 && t[1]==0 && t[2]==0) break;
while(1){
gets(s);
if(s[0] == '#') break;
clock=10*(s[0]-'0') + (s[1]-'0');
minute=10*(s[3]-'0') + (s[4]-'0');
time= 60*(clock-8) + minute;
people=s[6]-'0';
if(people==1 || people==2) n = 0;
else if(people==3 || people==4) n = 1;
else if(people==5 || people==6) n = 2;
if(time >= tab[n].end[k[n]]){
tab[n].end[k[n]] = time + 30;
k[n] ++;
if(k[n] > t[n]) k[n] = 1;
sum += people;
}
else if(time >= tab[n].wait_time[k[n]]){
tab[n].wait_time[k[n]] = tab[n].end[k[n]];
tab[n].end[k[n]] += 30;
k[n] ++;
if(k[n] > t[n]) k[n] = 1;
sum+=people;
}
}
cout<<sum<<endl;
}
return 0;
}
| 19.991304
| 64
| 0.535015
|
bilibiliShen
|
f4415d9c60c8b8bead0b2f5e0e10b0847385321f
| 233
|
cpp
|
C++
|
src/main.cpp
|
xiyue-studio/Popsicle
|
d62304c573391fcd0cf04c058d1a31af54882046
|
[
"MIT"
] | 3
|
2019-07-16T02:50:02.000Z
|
2020-01-31T12:31:32.000Z
|
src/main.cpp
|
xiyue-studio/Popsicle
|
d62304c573391fcd0cf04c058d1a31af54882046
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
xiyue-studio/Popsicle
|
d62304c573391fcd0cf04c058d1a31af54882046
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
#include "px_server.h"
int main(int argc, const char* argv[])
{
(void)argc;
(void)argv;
px_server::PxServer server;
if (!server.run(8080))
{
printf("PxServer can not run!\n");
return -1;
}
return 0;
}
| 14.5625
| 38
| 0.643777
|
xiyue-studio
|
f4447a6190884b46f36c98e0e4b0a90502605e1f
| 1,277
|
cpp
|
C++
|
client/client/binaryConverter.cpp
|
CanOpener/PongPlusPlus-vcpp-Client
|
e3a8eef252b81f0c69fd646b1d39eefea1dd07da
|
[
"MIT"
] | null | null | null |
client/client/binaryConverter.cpp
|
CanOpener/PongPlusPlus-vcpp-Client
|
e3a8eef252b81f0c69fd646b1d39eefea1dd07da
|
[
"MIT"
] | null | null | null |
client/client/binaryConverter.cpp
|
CanOpener/PongPlusPlus-vcpp-Client
|
e3a8eef252b81f0c69fd646b1d39eefea1dd07da
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
#include "binaryConverter.h"
#include <cstdint>
#include <string>
uint8_t binaryConverter::readUint8(BYTE** seeker) {
uint8_t retInt = **(seeker);
(*seeker)++;
return retInt;
}
uint16_t binaryConverter::readUint16(BYTE** seeker) {
uint16_t* p = (uint16_t*)*seeker;
uint16_t retInt = *p;
(*seeker) += sizeof(uint16_t);
return retInt;
}
uint32_t binaryConverter::readUint32(BYTE** seeker) {
uint32_t* p = (uint32_t*)(*seeker);
uint32_t retInt = *p;
(*seeker) += sizeof(uint32_t);
return retInt;
}
string binaryConverter::readString(BYTE** seeker) {
string str((const char*)(*seeker));
(*seeker) += str.length() + 1; // skip null
return str;
}
void binaryConverter::writeUint8(BYTE** seeker, uint8_t data) {
**seeker = data;
(*seeker)++;
}
void binaryConverter::writeUint16(BYTE** seeker, uint16_t data) {
memcpy(*seeker, &data, sizeof(uint16_t));
(*seeker) += sizeof(uint16_t);
}
void binaryConverter::writeUint32(BYTE** seeker, uint32_t data) {
memcpy(*seeker, &data, sizeof(uint32_t));
(*seeker) += sizeof(uint32_t);
}
void binaryConverter::writeString(BYTE** seeker, string data) {
auto len = data.length();
auto cStr = data.c_str();
memcpy(*seeker, cStr, len);
(*seeker) += len;
**seeker = 0; // null terminator
(*seeker)++;
}
| 26.061224
| 65
| 0.6852
|
CanOpener
|
f444b31a1eda4f58b65a995709e8f4affbbdb762
| 1,996
|
cpp
|
C++
|
Cpp/fostgres-fg/contains.cpp
|
amukha/fostgres
|
d908e80d6ebeafc456bae086dd397c216d59b001
|
[
"BSL-1.0"
] | 17
|
2017-02-06T07:54:49.000Z
|
2019-07-20T03:55:15.000Z
|
Cpp/fostgres-fg/contains.cpp
|
amukha/fostgres
|
d908e80d6ebeafc456bae086dd397c216d59b001
|
[
"BSL-1.0"
] | 17
|
2017-06-01T08:51:26.000Z
|
2019-09-02T13:46:23.000Z
|
Cpp/fostgres-fg/contains.cpp
|
amukha/fostgres
|
d908e80d6ebeafc456bae086dd397c216d59b001
|
[
"BSL-1.0"
] | 6
|
2017-05-03T13:05:19.000Z
|
2019-08-06T11:34:41.000Z
|
/**
Copyright 2016-2019 Red Anchor Trading Co. Ltd.
Distributed under the Boost Software License, Version 1.0.
See <http://www.boost.org/LICENSE_1_0.txt>
*/
#include <fostgres/fg/contains.hpp>
#include <fost/test>
namespace {
fostlib::nullable<fostlib::jcursor>
walk(fostlib::jcursor &path,
const fostlib::json &super,
const fostlib::json &sub) {
if (sub.isnull() || sub.isatom() || sub.isarray()) {
if (super[path] == sub) {
return fostlib::null;
} else {
return path;
}
} else if (sub.isobject()) {
for (fostlib::json::const_iterator p(sub.begin()); p != sub.end();
++p) {
path /= p.key();
if (super.has_key(path)) {
auto part = walk(path, super, *p);
if (part) return path;
} else {
if (*p != fostlib::json()) { return path; }
}
path.pop();
}
} else {
throw fostlib::exceptions::not_implemented(
__func__, "Can't walk across ths sub-object", sub);
}
return fostlib::null;
}
}
fostlib::nullable<fostlib::jcursor>
fg::contains(const fg::json &super, const fg::json &sub) {
fostlib::jcursor path;
return walk(path, super, sub);
}
void fg::throw_contains_error(
fg::json actual, fg::json expected, fg::jcursor contains) {
fostlib::exceptions::test_failure error(
"Mismatched response body", __FILE__, __LINE__);
fostlib::insert(error.data(), "expected", expected);
fostlib::insert(error.data(), "actual", actual);
fostlib::insert(error.data(), "mismatch", "path", contains);
fostlib::insert(error.data(), "mismatch", "expected", expected[contains]);
fostlib::insert(error.data(), "mismatch", "actual", actual[contains]);
throw error;
}
| 31.68254
| 78
| 0.536072
|
amukha
|
f444f1a021b6959cfaa669aa4c05333b0d50a5fc
| 1,883
|
cpp
|
C++
|
solver.cpp
|
banche/ski-in-singapore
|
8d4039da879061e38450567fe7bdc7247858e850
|
[
"MIT"
] | null | null | null |
solver.cpp
|
banche/ski-in-singapore
|
8d4039da879061e38450567fe7bdc7247858e850
|
[
"MIT"
] | null | null | null |
solver.cpp
|
banche/ski-in-singapore
|
8d4039da879061e38450567fe7bdc7247858e850
|
[
"MIT"
] | null | null | null |
#include "solver.hpp"
namespace SkiChallenge {
//fit it inside 64bits
struct BoxState {
uint32_t pathLength;
uint32_t drop;
bool isVisited;
BoxState();
};
BoxState::BoxState()
: pathLength(0)
, drop(0)
, isVisited(0)
{
}
typedef std::vector<BoxState> BoxStates;
void lookNeighbors(const Mountain& mountain, BoxStates& states, unsigned int index)
{
Mountain::Neighbors neighbors = mountain.downhillNeighbors(index);
for(auto n: neighbors)
{
// first time we visit it check the neighbors
if( not states[n].isVisited)
{
lookNeighbors(mountain,states,n);
}
auto pathLength = states[n].pathLength + 1;
uint32_t drop = states[n].drop + mountain[index] - mountain[n];
// keep best only
if(pathLength > states[index].pathLength)
{
states[index].pathLength = pathLength;
states[index].drop = drop;
}
else if ( pathLength == states[index].pathLength)
{
states[index].drop = std::max(states[index].drop,drop);
}
}
// mark state as visited
// no need to redo the computation for this state
states[index].isVisited = true;
}
std::pair<unsigned int,unsigned int> findLongestPath(const Mountain& mountain)
{
// init states with 0 and not visited
BoxStates states(mountain.size());
uint32_t maxPathLength = 0;
uint32_t maxDrop = 0;
// for all hills compute pathLength and drop
// save the best one
for ( auto i = 0; i < mountain.size() ; ++i)
{
if ( not states[i].isVisited )
lookNeighbors(mountain,states,i);
if(states[i].pathLength > maxPathLength)
{
maxPathLength = states[i].pathLength;
maxDrop = states[i].drop;
}
else if ( states[i].pathLength == maxPathLength)
{
maxDrop = std::max(states[i].drop,maxDrop);
}
}
return std::pair<unsigned int,unsigned int>(maxPathLength+1,maxDrop);
}
}
| 22.963415
| 83
| 0.653744
|
banche
|
f4477343417009a6d56ce11003eb2d33d74bb35c
| 207
|
hpp
|
C++
|
hiro/reference/widget/frame.hpp
|
mp-lee/higan
|
c38a771f2272c3ee10fcb99f031e982989c08c60
|
[
"Intel",
"ISC"
] | 38
|
2018-04-05T05:00:05.000Z
|
2022-02-06T00:02:02.000Z
|
hiro/reference/widget/frame.hpp
|
ameer-bauer/higan-097
|
a4a28968173ead8251cfa7cd6b5bf963ee68308f
|
[
"Info-ZIP"
] | 2
|
2015-10-06T14:59:48.000Z
|
2022-01-27T08:57:57.000Z
|
hiro/reference/widget/frame.hpp
|
ameer-bauer/higan-097
|
a4a28968173ead8251cfa7cd6b5bf963ee68308f
|
[
"Info-ZIP"
] | 8
|
2018-04-16T22:37:46.000Z
|
2021-02-10T07:37:03.000Z
|
namespace phoenix {
struct pFrame : public pWidget {
Frame& frame;
void setText(string text);
pFrame(Frame& frame) : pWidget(frame), frame(frame) {}
void constructor();
void destructor();
};
}
| 14.785714
| 56
| 0.671498
|
mp-lee
|
f453fcd3bb51b8ad656c7150af72ebc1dfb907c8
| 9,715
|
cpp
|
C++
|
TFV_PopulatingFunctions.cpp
|
budomino/task-feed-visualizer
|
7c03f3530c867e3e1f7a1334f4eb06f24e8faf9c
|
[
"MIT"
] | null | null | null |
TFV_PopulatingFunctions.cpp
|
budomino/task-feed-visualizer
|
7c03f3530c867e3e1f7a1334f4eb06f24e8faf9c
|
[
"MIT"
] | null | null | null |
TFV_PopulatingFunctions.cpp
|
budomino/task-feed-visualizer
|
7c03f3530c867e3e1f7a1334f4eb06f24e8faf9c
|
[
"MIT"
] | null | null | null |
#include "TFV_PopulatingFunctions.h"
#include <alphanum.hpp>
using std::string;
using std::vector;
using std::cout;
using std::endl;
// summary of file: stores most of the actual custom class functions used to run the program
tab CreateTableItems(tab currentTab, bool printLog, bool veryVerbose)
{
// summary: read the contents of tab and output as a label item
bool primedForDescription = false;
item currentItem;
string descriptionContent;
bool currentlyMakingNewLabel = false;
string textFile = currentTab.GetFile().toUtf8().constData();
cout << "text file is: " << textFile << endl;
std::ifstream tabFile(textFile.c_str());
// parse each line "p" in the file retrieved
for (std::string p; std::getline(tabFile, p);)
{
if (printLog) cout << "line content is: " << p << endl;
if (!primedForDescription)
{
if (p.empty())
{
if (printLog & veryVerbose) cout << "line is empty" << endl;
// just skip if empty
}
else if (p.find("----") != string::npos)
{
if (printLog & veryVerbose) cout << "line contains divider" << endl;
// create a new label if this is the first divider in an entry
// if already making new label, that means it's the closing divider. push the new item into the vector and then clear everything
if (currentlyMakingNewLabel)
{
if (printLog) currentItem.PrintCurrentItem();
currentTab.items.push_back(currentItem);
currentItem.ClearAll();
}
else
{
// only activated at the very first divider to prime the scanner for new items
if (printLog) cout << "Ok, making the next label..." << endl;
currentlyMakingNewLabel = true;
}
}
else if (p.find("FROM:") != string::npos)
{
if (printLog & veryVerbose) cout << "line contains assigner name" << endl;
primedForDescription = true;
if (printLog) cout << "Current item has been primed for description." << endl;
string pFind = "FROM:";
currentItem.SetName(p.erase(p.find(pFind),pFind.length()));
if (printLog & veryVerbose) cout << "FROM has been added... " << endl;
}
else if (p.find("STATUS:") != string::npos)
{
if (printLog) cout << "line contains status but you shouldn't be seeing this particular debug line!" << endl;
}
else if (p.find("PRIORITY:") != string::npos)
{
if (printLog & veryVerbose) cout << "line contains priority" << endl;
string pFind = "PRIORITY:";
priority newPriority;
string pFindErase = (p.erase(p.find(pFind),pFind.length()));
if (printLog) cout << "erased priority string is " << pFindErase << endl;
newPriority.SetPriority(pFindErase);
if (printLog) cout << "priority for item is " << newPriority.GetPriorityIndex() << ", or " << newPriority.GetPriority() << endl;
currentItem.SetPriority(newPriority);
}
else
{
if (printLog) cout << "line contains something else that we don't recognize" << endl;
}
}
// if primed to build the item description, check if the line is the status line. if not, add the line to the description
else
{
if (p.find("PROJECT:") != string::npos)
{
if (printLog & veryVerbose) cout << "line contains project name" << endl;
string pFind = "PROJECT:";
currentItem.SetProject(p.erase(p.find(pFind),pFind.length()));
if (printLog) cout << "Project name added" << endl;
}
else if (p.find("STATUS:") != string::npos)
{
primedForDescription = false;
currentItem.SetDescription(descriptionContent);
descriptionContent.clear();
if (printLog & veryVerbose) cout << "line contains status and is no longer primed for description" << endl;
bool setToOtherDay(p.find("MOVED") != string::npos);
currentItem.SetMTOD(setToOtherDay);
string pFind = "STATUS:";
currentItem.SetStatPrimary(p.erase(p.find(pFind),pFind.length()));
}
else
{
descriptionContent.append(p + "\n");
}
}
if (printLog & veryVerbose) cout << "Line processed. Going to next line..." << endl;
}
if (printLog & veryVerbose)
{
cout << "CurrentTab contains: " << endl;
for (item currentIt : currentTab.items) currentIt.PrintCurrentItem();
}
return currentTab;
}
taskFeedFile PopulateTables(QString sourcePath)
{
// summary: reads the current directory for all subdirectories containing days and then turns each day into a tab
// check first if sourcePath is valid. Otherwise, use the working directory
cout << "Source Path is " << sourcePath.toUtf8().constData() << endl;
if (sourcePath.isNull()) sourcePath = QDir::currentPath();
else {}
// process sourcePath and declare other stuff
QDirIterator directoryLists(sourcePath, QDir::Files | QDir::NoDotAndDotDot , QDirIterator::Subdirectories );
QStringList fileLocations;
std::vector<tab> tabs;
taskFeedFile taskFeedFile;
// for each directory, check if it follows the format of "Assigned <Day> <Month>" and then add that into the list of directories
while (directoryLists.hasNext())
{
if (directoryLists.filePath().contains("Assigned") & directoryLists.filePath().contains("Task Feed") & directoryLists.filePath().contains(".txt") & !directoryLists.filePath().contains("~"))
{
cout << directoryLists.filePath().toUtf8().constData() << " is a valid task feed file" << endl;
fileLocations.append(directoryLists.fileInfo().absoluteFilePath());
tab newTab;
newTab.SetFile(directoryLists.filePath());
newTab.SetTabName(directoryLists.fileName());
tabs.push_back(newTab);
}
else cout << directoryLists.filePath().toUtf8().constData() << " is not an applicable file" << endl;
directoryLists.next();
}
// if the program can't locate any valid files, exit
if (tabs.empty())
return taskFeedFile;
// sort tabs alphanumerically. Note that fileLocations does not get sorted because it'll only be used to check if the files have been modified
std::sort(tabs.begin(),tabs.end(),doj::alphanum_less<tab>());
// create the tabs in the UI and then populate them with items
cout << "creating tabs..." << endl;
for (tab& t : tabs)
{
// create table items
cout << "Now creating table items of " << t.GetFile().toUtf8().constData() << " ... " << endl;
t = CreateTableItems(t,true,true);
cout << "number of tasks in this tab is: " << t.items.size() << endl;;
}
cout << "Total number of tabs is: " << tabs.size() << endl;
cout << "Total number of file locations is: " << fileLocations.size() << endl;
#ifdef DEBUG
// debug log to output all content
cout << "tabs created! outputting all internal content..." << endl;
for (tab t : tabs)
{
cout << t.GetFile().toUtf8().constData() << endl;
cout << "Number of tasks: " << t.items.size() << endl;
for (item specificItem: t.items) {specificItem.PrintCurrentItem();}
cout << "end of tab " << t.GetFile().toUtf8().constData() << endl << endl;
}
#endif
taskFeedFile.setTabsVector(tabs);
taskFeedFile.setFileLocations(fileLocations);
return taskFeedFile;
}
string populateItems(item i)
{
// summary: remake a readable version of each item within a tab using a better format than the one in the text file
//cout << "Remaking a readable version of the item to use in the label..." << endl;
string result;
string newline = "\n";
// 16Feb2021: need to allocate enough memory for this long string to fix a bug. Uses an arbitrary value of 1000 to be safe.
result.reserve(1000);
//cout << "Maximum string size is: " << result.max_size() << endl;
result = "FROM: " + i.GetName() + newline;
bool projectNotEmpty = empty(i.GetProject());
if (!projectNotEmpty)
{
result += "PROJECT: " + i.GetProject() + newline;
}
else;
result += i.GetDesc()
+ "STATUS: " + i.GetStatPrimary();
// cout << "Checking if a secondary status exists..." << endl;
bool statSecNotEmpty = empty(i.GetStatSec());
if (!statSecNotEmpty)
{
//cout << "Secondary status exists. Appending..." << endl;
result += i.GetStatSec() + newline;
}
else
{
//cout << "Secondary status does not exist." << endl;
result += newline;
}
//initialResult.clear();
result += "PRIORITY: " + i.ReadPriority();
//cout << "Priority index is " << i.GetPriority().GetPriorityIndex() << endl;
// shrink the previously-allocated memory down to the actual size, to save memory
result.shrink_to_fit();
//cout << "String size is: " << result.size() << endl;
return result;
}
| 37.655039
| 201
| 0.575399
|
budomino
|
f45e89170105de927958717e921db4ef9740121a
| 3,050
|
cpp
|
C++
|
test/program-nn-test.cpp
|
huangjd/simit-staging
|
6a1d7946e88c7bf383abe800ee835d3680e86559
|
[
"MIT"
] | 496
|
2016-06-10T04:16:47.000Z
|
2022-01-24T19:37:03.000Z
|
test/program-nn-test.cpp
|
huangjd/simit-staging
|
6a1d7946e88c7bf383abe800ee835d3680e86559
|
[
"MIT"
] | 91
|
2016-07-26T13:18:48.000Z
|
2021-08-10T08:54:18.000Z
|
test/program-nn-test.cpp
|
huangjd/simit-staging
|
6a1d7946e88c7bf383abe800ee835d3680e86559
|
[
"MIT"
] | 63
|
2016-07-22T17:15:46.000Z
|
2021-08-20T03:18:42.000Z
|
#include "simit-test.h"
#include <cmath>
#include <iostream>
#include "graph.h"
#include "program.h"
#include "error.h"
using namespace std;
using namespace simit;
TEST(Program, DISABLED_nn) {
// Points
Set nodes;
FieldRef<simit_float> outv = nodes.addField<simit_float>("outv");
FieldRef<simit_float> inv = nodes.addField<simit_float>("inv");
FieldRef<simit_float> d = nodes.addField<simit_float>("d");
FieldRef<simit_float> print = nodes.addField<simit_float>("print");
// Springs
Set edges(nodes,nodes);
FieldRef<simit_float> w = edges.addField<simit_float>("w");
int l0 = 3;
int l1 = 3;
//create nodes
vector<simit::ElementRef> nodeRefs;
//input layer
for(int ii = 0; ii<l0; ii++){
nodeRefs.push_back(nodes.add());
}
inv.set(nodeRefs[0], 0.1);
inv.set(nodeRefs[1], 0.421512737531634);
inv.set(nodeRefs[2], 0.68278294534791);
//input bias node
simit::ElementRef n = nodes.add();
nodeRefs.push_back(n);
inv.set(n, 1.0);
//middle layer
vector<simit::ElementRef> middleLayer;
int nInput = l0+1;
for(int ii = 0; ii<l1; ii++){
nodeRefs.push_back(nodes.add());
}
//edges
vector<simit::ElementRef> edgeRefs;
for(int ii = 0; ii<l1; ii++){
for(int jj = 0; jj<4; jj++){
int inputIdx = ii+jj;
if(inputIdx>=nInput){
break;
}
int outputIdx = ii + nInput;
simit::ElementRef edge = edges.add(nodeRefs[inputIdx], nodeRefs[outputIdx]);
edgeRefs.push_back(edge);
//has to initialize with some random weights
simit_float rw = (ii*4.0+jj)/(4.0*l1)+0.01;
w.set(edge, rw);
}
}
std::cout << "Inv" << std::endl;
for (auto &n : nodeRefs) {
std::cout << (simit_float)inv.get(n) << std::endl;
}
std::cout << std::endl;
std::cout << "Weights" << std::endl;
for (auto &e : edgeRefs) {
std::cout << (simit_float)w.get(e) << std::endl;
}
std::cout << std::endl;
// Compile program and bind arguments
Function func = loadFunction(TEST_FILE_NAME, "main");
if (!func.defined()) FAIL();
func.bind("nodes", &nodes);
func.bind("edges", &edges);
func.runSafe();
std::cout << "Check" << std::endl;
for (auto &n : nodeRefs) {
std::cout << (simit_float)print.get(n) << std::endl;
}
std::cout << std::endl;
std::cout << "Outv" << std::endl;
for (auto &n : nodeRefs) {
std::cout << (simit_float)outv.get(n) << std::endl;
}
// Check outputs
// TensorRef<simit_float,3> f0 = f.get(p0);
// ASSERT_SIMIT_FLOAT_EQ(2422.649730810374, f0(0));
// ASSERT_SIMIT_FLOAT_EQ(2422.649730810374, f0(1));
// ASSERT_SIMIT_FLOAT_EQ(2407.9347308103738, f0(2));
//
// TensorRef<simit_float,3> f1 = f.get(p1);
// ASSERT_SIMIT_FLOAT_EQ(-1961.3248654051868, f1(0));
// ASSERT_SIMIT_FLOAT_EQ(-1961.3248654051868, f1(1));
// ASSERT_SIMIT_FLOAT_EQ(-2029.9948654051868, f1(2));
//
// TensorRef<simit_float,3> f2 = f.get(p2);
// ASSERT_SIMIT_FLOAT_EQ(-461.3248654051871, f2(0));
// ASSERT_SIMIT_FLOAT_EQ(-461.3248654051871, f2(1));
// ASSERT_SIMIT_FLOAT_EQ(-480.9448654051871, f2(2));
}
| 26.99115
| 82
| 0.637705
|
huangjd
|
f46172ed427d5fa081a416293dd8d34f5007519a
| 2,506
|
hpp
|
C++
|
include/boost/connector/vendor/ftx/channel_event.hpp
|
madmongo1/boost_connector
|
4c51c0074a7604acae685365cdcd0258d9a32f8e
|
[
"BSL-1.0"
] | 6
|
2021-09-09T12:48:39.000Z
|
2021-09-23T16:06:38.000Z
|
include/boost/connector/vendor/ftx/channel_event.hpp
|
madmongo1/boost_connector
|
4c51c0074a7604acae685365cdcd0258d9a32f8e
|
[
"BSL-1.0"
] | null | null | null |
include/boost/connector/vendor/ftx/channel_event.hpp
|
madmongo1/boost_connector
|
4c51c0074a7604acae685365cdcd0258d9a32f8e
|
[
"BSL-1.0"
] | null | null | null |
//
// Copyright (c) 2021 Richard Hodges (hodges.r@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/madmongo1/router
//
#ifndef BOOST_CONNECTOR_SRC_VENDOR_FTX_DETAIL_CHANNEL_EVENT_HPP
#define BOOST_CONNECTOR_SRC_VENDOR_FTX_DETAIL_CHANNEL_EVENT_HPP
#include <boost/connector/config/error.hpp>
#include <boost/json/value.hpp>
#include <boost/variant2/variant.hpp>
namespace boost::connector::vendor::ftx
{
struct connection_up
{
};
struct connection_down
{
};
/// @brief indicates an event on a channel
struct channel_event
{
channel_event(connection_up e)
: var_(e)
{
}
channel_event(connection_down e)
: var_(e)
{
}
channel_event(json::value v)
: var_(std::move(v))
{
}
channel_event(error_code ec)
: var_(ec)
{
}
bool
is_down() const
{
return holds_alternative< connection_down >(var_);
}
bool
is_error() const
{
return holds_alternative< error_code >(var_);
}
bool
is_up() const
{
return holds_alternative< connection_up >(var_);
}
bool
is_response() const
{
return holds_alternative< json::value >(var_);
}
/// @brief Test if the event is a response of type "subscribed"
/// @return boolean.
/// @throws never throws. A malformed json value will result in a false
/// return value.
bool
is_subscribed() const
{
auto result = false;
if (auto pval = get_if< json::value >(&var_))
if (auto pobject = pval->if_object())
if (auto ptype = pobject->if_contains("type"))
if (auto pstr = ptype->if_string())
if (*pstr == "subscribed")
result = true;
return result;
}
json::value &
get_response()
{
return get< json::value >(var_);
}
json::value const &
get_response() const
{
return get< json::value >(var_);
}
error_code const &
get_error() const
{
return get< error_code >(var_);
}
private:
using var_type = variant2::
variant< connection_down, connection_up, json::value, error_code >;
var_type var_;
};
} // namespace boost::connector::vendor::ftx
#endif // BOOST_CONNECTOR_SRC_VENDOR_FTX_DETAIL_CHANNEL_EVENT_HPP
| 20.883333
| 79
| 0.614126
|
madmongo1
|
c2e1531152064b0a4614be695c65923635e795a5
| 340
|
cpp
|
C++
|
src/ir/ir_exp_mem.cpp
|
Wassasin/splicpp
|
b88bf8ec18985bc6ee5a8ccb952f413f23d74c5a
|
[
"Beerware"
] | 2
|
2019-04-09T01:04:36.000Z
|
2019-05-12T06:17:03.000Z
|
src/ir/ir_exp_mem.cpp
|
Wassasin/splicpp
|
b88bf8ec18985bc6ee5a8ccb952f413f23d74c5a
|
[
"Beerware"
] | null | null | null |
src/ir/ir_exp_mem.cpp
|
Wassasin/splicpp
|
b88bf8ec18985bc6ee5a8ccb952f413f23d74c5a
|
[
"Beerware"
] | null | null | null |
#include "ir_exp_mem.hpp"
#include "../mappers/generic/ir_exp_mapper.hpp"
namespace splicpp
{
void ir_exp_mem::map(ir_exp_mapper& t) const
{
t.map(std::static_pointer_cast<const ir_exp_mem>(shared_from_this()));
}
void ir_exp_mem::print(std::ostream& s, const uint tab) const
{
s << "MEM(";
e->print(s, tab);
s << ")";
}
}
| 17.894737
| 72
| 0.670588
|
Wassasin
|
c2e2d5cb868fb888ca0d20f5a83a9ce2cc963f65
| 3,516
|
cpp
|
C++
|
src/c++/lib/flowcell/FastqLayout.cpp
|
Illumina/Isaac4
|
0924fba8b467868da92e1c48323b15d7cbca17dd
|
[
"BSD-3-Clause"
] | 13
|
2018-02-09T22:59:39.000Z
|
2021-11-29T06:33:22.000Z
|
src/c++/lib/flowcell/FastqLayout.cpp
|
Illumina/Isaac4
|
0924fba8b467868da92e1c48323b15d7cbca17dd
|
[
"BSD-3-Clause"
] | 17
|
2018-01-26T11:36:07.000Z
|
2022-02-03T18:48:43.000Z
|
src/c++/lib/flowcell/FastqLayout.cpp
|
Illumina/Isaac4
|
0924fba8b467868da92e1c48323b15d7cbca17dd
|
[
"BSD-3-Clause"
] | 4
|
2018-10-19T20:00:00.000Z
|
2020-10-29T14:44:06.000Z
|
/**
** Isaac Genome Alignment Software
** Copyright (c) 2010-2017 Illumina, Inc.
** All rights reserved.
**
** This software is provided under the terms and conditions of the
** GNU GENERAL PUBLIC LICENSE Version 3
**
** You should have received a copy of the GNU GENERAL PUBLIC LICENSE Version 3
** along with this program. If not, see
** <https://github.com/illumina/licenses/>.
**
** \file FastqLayout.cpp
**
** Flowcell file locations and such
**
** \author Roman Petrovski
**/
#include "common/FileSystem.hh"
#include "flowcell/FastqLayout.hh"
namespace isaac
{
namespace flowcell
{
namespace fastq
{
void getFastqFilePath(
const boost::filesystem::path &baseCallsPath,
const unsigned lane,
const unsigned read,
const bool compressed,
boost::filesystem::path &result)
{
ISAAC_ASSERT_MSG(read <= fastq::READ_NUMBER_MAX, "Read number " << read << " must not exceed " << fastq::READ_NUMBER_MAX);
// Warning: all this mad code below is to avoid memory allocations during path formatting.
// the result is expected to be pre-sized, else allocations will occur as usual.
char fastqFileName[100];
/*const int fastqFileNameLength = */snprintf(fastqFileName, sizeof(fastqFileName),
(compressed ?
"%clane%d_read%d.fastq.gz" : "%clane%d_read%d.fastq"),
common::getDirectorySeparatorChar(), lane, read);
// // boost 1.46 implementation of filesystem::path is coded to instantiate an std::string
// // when doing append. Therefore have to jump through hoops to prevent memory allocations from happening
// std::string & pathInternalStringRef = const_cast<std::string&>(result.string());
// pathInternalStringRef = baseCallsPath.string().c_str();
// pathInternalStringRef.append(fastqFileName, fastqFileName + fastqFileNameLength);
result = baseCallsPath.c_str();
result /= boost::filesystem::path(fastqFileName);
}
} //namespace fastq
template<>
const boost::filesystem::path &Layout::getLaneReadAttribute<Layout::Fastq, FastqFilePathAttributeTag>(
const unsigned lane, const unsigned read, boost::filesystem::path &result) const
{
ISAAC_ASSERT_MSG(Fastq == format_, FastqFilePathAttributeTag() << " is only allowed for fastq flowcells");
ISAAC_ASSERT_MSG(lane <= laneNumberMax_, "Lane number " << lane << " must not exceed " << laneNumberMax_);
const FastqFlowcellData &data = boost::get<FastqFlowcellData>(formatSpecificData_);
fastq::getFastqFilePath(getBaseCallsPath(), lane, read, data.compressed_, result);
return result;
}
template<>
const FastqBaseQ0::value_type &Layout::getAttribute<Layout::Fastq, FastqBaseQ0>(
FastqBaseQ0::value_type &result) const
{
ISAAC_ASSERT_MSG(Fastq == format_, FastqBaseQ0() << " is only allowed for fastq flowcells");
const FastqFlowcellData &data = boost::get<FastqFlowcellData>(formatSpecificData_);
result = data.fastqQ0_;
return result;
}
template<>
const FastqVariableLengthOk::value_type &Layout::getAttribute<Layout::Fastq, FastqVariableLengthOk>(
FastqVariableLengthOk::value_type &result) const
{
ISAAC_ASSERT_MSG(Fastq == format_, FastqVariableLengthOk() << " is only allowed for fastq flowcells");
const FastqFlowcellData &data = boost::get<FastqFlowcellData>(formatSpecificData_);
result = data.allowVariableLength_;
return result;
}
} // namespace flowcell
} // namespace isaac
| 35.877551
| 126
| 0.703925
|
Illumina
|
c2e5438191154e958b09e90d0734ad7588b949b7
| 6,687
|
cpp
|
C++
|
editor/source/widget/output/widget_output_bar.cpp
|
skarab/coffee-master
|
6c3ff71b7f15735e41c9859b6db981b94414c783
|
[
"MIT"
] | null | null | null |
editor/source/widget/output/widget_output_bar.cpp
|
skarab/coffee-master
|
6c3ff71b7f15735e41c9859b6db981b94414c783
|
[
"MIT"
] | null | null | null |
editor/source/widget/output/widget_output_bar.cpp
|
skarab/coffee-master
|
6c3ff71b7f15735e41c9859b6db981b94414c783
|
[
"MIT"
] | null | null | null |
#include "widget/output/widget_output_bar.h"
namespace coffee_editor
{
//-META---------------------------------------------------------------------------------------//
COFFEE_BeginType(widget::OutputBar);
COFFEE_Ancestor(ui::Window);
COFFEE_EndType();
namespace widget
{
//-CONSTRUCTORS-------------------------------------------------------------------------------//
OutputBar::OutputBar() :
_FilterAll(NULL),
_FilterErrors(NULL),
_FilterWarnings(NULL),
_Clear(NULL),
_Label(NULL),
_Output(NULL)
{
}
//--------------------------------------------------------------------------------------------//
OutputBar::~OutputBar()
{
}
//-OPERATIONS---------------------------------------------------------------------------------//
void OutputBar::Create(ui::Window* parent, uint32 height)
{
ui::Window::Create(parent, basic::Vector2i(), basic::Vector2i(0, height), ui::WINDOW_STYLE_None);
GetLayout().SetStyle(
ui::LAYOUT_STYLE_HorizontalCanvas
| ui::LAYOUT_STYLE_StickChildren);
_FilterAll = COFFEE_New(ui::widget::Button);
_FilterAll->Create(this, basic::Vector2i(), basic::Vector2i(0, height), ui::widget::BUTTON_STYLE_PushLike);
_FilterAll->SetText("All");
_FilterAll->GetLayout().SetCanvas(60, false);
_FilterErrors = COFFEE_New(ui::widget::Button);
_FilterErrors->Create(this, basic::Vector2i(), basic::Vector2i(0, height), ui::widget::BUTTON_STYLE_PushLike);
_FilterErrors->SetText("Errors");
_FilterErrors->GetLayout().SetCanvas(60, false);
_FilterWarnings = COFFEE_New(ui::widget::Button);
_FilterWarnings->Create(this, basic::Vector2i(), basic::Vector2i(0, height), ui::widget::BUTTON_STYLE_PushLike);
_FilterWarnings->SetText("Warnings");
_FilterWarnings->GetLayout().SetCanvas(60, false);
_Clear = COFFEE_New(ui::widget::Button);
_Clear->Create(this, basic::Vector2i(), basic::Vector2i(0, height));
_Clear->SetText("Clear");
_Clear->GetLayout().SetCanvas(60, false);
_Label = COFFEE_New(ui::widget::Label);
_Label->Create(this, basic::Vector2i(), basic::Vector2i(0, height));
_Label->SetStyle(ui::WINDOW_STYLE_Activable | ui::WINDOW_STYLE_DrawFrame
| ui::WINDOW_STYLE_DrawClientSunken);
_Label->GetLayout().SetCanvas(80, true);
_Filter = FilterAll;
_UpdateFilters();
}
//--------------------------------------------------------------------------------------------//
void OutputBar::Update()
{
shell::Locker lock(_Mutex);
ui::Window::Update();
}
//-EVENTS-------------------------------------------------------------------------------------//
COFFEE_BeginEventHandler(OutputBar, ui::Window)
COFFEE_RegisterTargetEventHandler(ui::widget::EVENT_Pressed, ui::widget::Widget, _FilterAll, OnFilterAll)
COFFEE_RegisterTargetEventHandler(ui::widget::EVENT_Pressed, ui::widget::Widget, _FilterErrors, OnFilterErrors)
COFFEE_RegisterTargetEventHandler(ui::widget::EVENT_Pressed, ui::widget::Widget, _FilterWarnings, OnFilterWarnings)
COFFEE_RegisterTargetEventHandler(ui::widget::EVENT_Pressed, ui::widget::Widget, _Clear, OnClear)
COFFEE_RegisterTargetEventHandler(ui::WINDOW_EVENT_Activate, ui::Window, _Label, OnOutput)
COFFEE_EndEventHandler()
//--------------------------------------------------------------------------------------------//
bool OutputBar::OnFilterAll(shell::Event& event)
{
_Filter = FilterAll;
return OnOutput(event);
}
//--------------------------------------------------------------------------------------------//
bool OutputBar::OnFilterErrors(shell::Event& event)
{
_Filter = FilterErrors;
return OnOutput(event);
}
//--------------------------------------------------------------------------------------------//
bool OutputBar::OnFilterWarnings(shell::Event& event)
{
_Filter = FilterWarnings;
return OnOutput(event);
}
//--------------------------------------------------------------------------------------------//
bool OutputBar::OnClear(shell::Event& event)
{
_Log.SetEmpty();
_LogType.Erase();
_Label->SetText("");
return true;
}
//--------------------------------------------------------------------------------------------//
bool OutputBar::OnOutput(shell::Event& event)
{
_UpdateFilters();
if (_Output==NULL)
{
_Output = COFFEE_New(Output);
_Output->Create(this);
COFFEE_RegisterExternEventHandler(shell::EVENT_MESSAGE_Destroyed,
shell::EventHandler::GetClassMetaType(), *_Output, OnDestroyOutput);
for (uint32 i=0 ; i<_LogType.GetSize() ; ++i)
OnLog(_LogType[i], _Log[i].GetBuffer(), false);
}
return true;
}
//--------------------------------------------------------------------------------------------//
bool OutputBar::OnDestroyOutput(shell::Event& event)
{
_Output = NULL;
return true;
}
//-HANDLERS-----------------------------------------------------------------------------------//
void OutputBar::OnLog(core::Log::Type type, const char* message, bool it_has_to_add)
{
shell::Locker lock(_Mutex);
if (it_has_to_add)
{
if (_LogType.GetSize()>=600)
{
_LogType.Remove(0);
_Log.RemoveLine(0);
}
_LogType.AddItem(type);
_Log.AddLine(message);
if (_Label!=NULL)
_Label->SetText(message);
}
if (_Output!=NULL)
{
if (_Filter==FilterAll
|| (_Filter==FilterWarnings && type==core::Log::Warning)
|| (_Filter==FilterErrors && type==core::Log::Error))
{
_Output->OnLog(type, message);
}
}
}
//-OPERATIONS---------------------------------------------------------------------------------//
void OutputBar::_UpdateFilters()
{
_FilterAll->SetState(_Filter==FilterAll?ui::widget::BUTTON_STATE_On:ui::widget::BUTTON_STATE_Off);
_FilterErrors->SetState(_Filter==FilterErrors?ui::widget::BUTTON_STATE_On:ui::widget::BUTTON_STATE_Off);
_FilterWarnings->SetState(_Filter==FilterWarnings?ui::widget::BUTTON_STATE_On:ui::widget::BUTTON_STATE_Off);
}
}
}
| 35.194737
| 123
| 0.490953
|
skarab
|
c2e73ccabe60819e09a9c081159fe8e971527f83
| 21,585
|
cpp
|
C++
|
shared/devdriver/apis/ddSocket/tests/ddSocketTests.cpp
|
GPUOpen-Drivers/pal
|
bcec463efe5260776d486a5e3da0c549bc0a75d2
|
[
"MIT"
] | 268
|
2017-12-22T11:03:10.000Z
|
2022-03-31T15:37:31.000Z
|
shared/devdriver/apis/ddSocket/tests/ddSocketTests.cpp
|
GPUOpen-Drivers/pal
|
bcec463efe5260776d486a5e3da0c549bc0a75d2
|
[
"MIT"
] | 79
|
2017-12-22T12:26:52.000Z
|
2022-03-30T13:06:30.000Z
|
shared/devdriver/apis/ddSocket/tests/ddSocketTests.cpp
|
GPUOpen-Drivers/pal
|
bcec463efe5260776d486a5e3da0c549bc0a75d2
|
[
"MIT"
] | 92
|
2017-12-22T12:21:16.000Z
|
2022-03-29T22:34:17.000Z
|
#include <ddSocketTests.h>
#include <ddCommon.h>
#include <ddNet.h>
#include <string>
using namespace DevDriver;
/// Unit Tests /////////////////////////////////////////////////////////////////////////////////////
/// Arbitrary protocol id value used for testing
const DDProtocolId kTestProtocolId = 64;
/// Used to specify the max number of connections that can be pending on an accept operation at once
const uint32_t kTestProtocolMaxPendingConnections = 8;
/// Used to specify a reasonable default timeout value for send/receive/accept operations
const uint32_t kTestTimeoutInMs = 1000;
/// Check that `Create()` calls validate their inputs sensibly
TEST_F(DDNoNetworkTest, ConnectArgumentValidation)
{
// Missing parameters
DD_RESULT result = ddSocketConnect(nullptr, nullptr);
ASSERT_EQ(result, DD_RESULT_COMMON_INVALID_PARAMETER);
// Missing output socket
DDSocketConnectInfo connectInfo = {};
result = ddSocketConnect(&connectInfo, nullptr);
ASSERT_EQ(result, DD_RESULT_COMMON_INVALID_PARAMETER);
// Missing connect info
DDSocket hSocket = DD_API_INVALID_HANDLE;
result = ddSocketConnect(nullptr, &hSocket);
ASSERT_EQ(result, DD_RESULT_COMMON_INVALID_PARAMETER);
// Empty connect info
result = ddSocketConnect(&connectInfo, &hSocket);
ASSERT_EQ(result, DD_RESULT_COMMON_INVALID_PARAMETER);
// Invalid client id
connectInfo.hConnection = reinterpret_cast<DDNetConnection>(static_cast<size_t>(0xdeadbeef));
connectInfo.clientId = DD_API_INVALID_CLIENT_ID;
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hSocket);
ASSERT_EQ(result, DD_RESULT_COMMON_INVALID_PARAMETER);
// Invalid protocol id
connectInfo.clientId = 0xdead;
connectInfo.protocolId = 0;
result = ddSocketConnect(&connectInfo, &hSocket);
ASSERT_EQ(result, DD_RESULT_COMMON_INVALID_PARAMETER);
}
// TODO: Listen argument validation
// TODO: Accept argument validation
// TODO: Send argument validation
// TODO: Receive argument validation
// TODO: Close argument validation
TEST_F(DDNetworkedTest, UnsuccessfulConnection)
{
DDSocket hSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
connectInfo.timeoutInMs = 100; // Use a small delay here since we expect this to time out
const DD_RESULT result = ddSocketConnect(&connectInfo, &hSocket);
ASSERT_EQ(result, DD_RESULT_DD_GENERIC_NOT_READY);
}
TEST_F(DDNetworkedTest, BasicConnection)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
// Verify that send/receive doesn't work on listen sockets
ASSERT_EQ(ddSocketSendRaw(hListenSocket, nullptr, 0, 0, nullptr), DD_RESULT_NET_SOCKET_TYPE_UNSUPPORTED);
ASSERT_EQ(ddSocketReceiveRaw(hListenSocket, nullptr, 0, 0, nullptr), DD_RESULT_NET_SOCKET_TYPE_UNSUPPORTED);
// Verify that version queries don't work on listening sockets
ASSERT_EQ(ddSocketQueryProtocolVersion(hListenSocket), 0u);
// Verify that the version was negotiated correctly
ASSERT_EQ(ddSocketQueryProtocolVersion(hClientSocket), 0u);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
TEST_F(DDNetworkedTest, AcceptClient)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hServerSocket = DD_API_INVALID_HANDLE;
result = ddSocketAccept(hListenSocket, kTestTimeoutInMs, &hServerSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
size_t bytesSent = 0;
result = ddSocketSendRaw(hClientSocket, nullptr, 0, kTestTimeoutInMs, &bytesSent);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
ASSERT_EQ(bytesSent, static_cast<size_t>(0));
size_t bytesReceived = 0;
result = ddSocketReceiveRaw(hServerSocket, nullptr, 0, kTestTimeoutInMs, &bytesReceived);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
ASSERT_EQ(bytesReceived, static_cast<size_t>(0));
ddSocketClose(hServerSocket);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
TEST_F(DDNetworkedTest, SimpleTransfer)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hServerSocket = DD_API_INVALID_HANDLE;
result = ddSocketAccept(hListenSocket, kTestTimeoutInMs, &hServerSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
// Send some test data over the network
constexpr uint8_t kTestData[] =
{
0, 1, 2, 3, 4, 5, 6, 7
};
ASSERT_EQ(ddSocketSend(hClientSocket, kTestData, sizeof(kTestData)), DD_RESULT_SUCCESS);
// Receive the test data into a new array
uint8_t testBuffer[sizeof(kTestData)] = {};
ASSERT_EQ(ddSocketReceive(hServerSocket, testBuffer, sizeof(testBuffer)), DD_RESULT_SUCCESS);
// Compare the data
ASSERT_EQ(memcmp(kTestData, testBuffer, sizeof(kTestData)), 0);
ddSocketClose(hServerSocket);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
TEST_F(DDNetworkedTest, SimpleSizePrefixedTransfer)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hServerSocket = DD_API_INVALID_HANDLE;
result = ddSocketAccept(hListenSocket, kTestTimeoutInMs, &hServerSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
// Send some test data over the network
constexpr uint8_t kTestData[] =
{
0, 1, 2, 3, 4, 5, 6, 7
};
ASSERT_EQ(ddSocketSendWithSizePrefix(hClientSocket, kTestData, sizeof(kTestData)), DD_RESULT_SUCCESS);
// Receive the test data into a new array
uint8_t testBuffer[sizeof(kTestData)] = {};
uint64_t sizePrefix = 0;
ASSERT_EQ(ddSocketReceiveWithSizePrefix(hServerSocket, testBuffer, sizeof(testBuffer), nullptr), DD_RESULT_COMMON_INVALID_PARAMETER);
ASSERT_EQ(ddSocketReceiveWithSizePrefix(hServerSocket, testBuffer, sizeof(testBuffer), &sizePrefix), DD_RESULT_SUCCESS);
ASSERT_EQ(sizePrefix, static_cast<uint64_t>(sizeof(testBuffer)));
// Compare the data
ASSERT_EQ(memcmp(kTestData, testBuffer, sizeof(kTestData)), 0);
ddSocketClose(hServerSocket);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
class SingleThreadedTransferHelper
{
public:
SingleThreadedTransferHelper(DDSocket hClientSocket, DDSocket hServerSocket)
: m_hClientSocket(hClientSocket)
, m_hServerSocket(hServerSocket)
, m_pSendData(nullptr)
, m_sendDataSize(0)
, m_totalBytesSent(0)
, m_receiveBuffer(Platform::GenericAllocCb)
, m_totalBytesReceived(0)
{
}
DD_RESULT Transfer(const void* pData, size_t dataSize)
{
m_totalBytesSent = 0;
m_totalBytesReceived = 0;
m_pSendData = pData;
m_sendDataSize = dataSize;
m_receiveBuffer.Resize(dataSize);
DD_RESULT result = DD_RESULT_SUCCESS;
while ((result == DD_RESULT_SUCCESS) && (m_totalBytesSent < m_sendDataSize))
{
result = Send();
if (result == DD_RESULT_DD_GENERIC_NOT_READY)
{
result = Receive();
if (result == DD_RESULT_DD_GENERIC_NOT_READY)
{
result = DD_RESULT_SUCCESS;
}
}
}
while ((result == DD_RESULT_SUCCESS) && (m_totalBytesReceived < m_totalBytesSent))
{
result = Receive();
if (result == DD_RESULT_DD_GENERIC_NOT_READY)
{
result = DD_RESULT_SUCCESS;
}
}
if (result == DD_RESULT_SUCCESS)
{
result = ValidateTransfer();
}
return result;
}
bool IsTransferComplete() const
{
return (m_totalBytesReceived == m_sendDataSize);
}
private:
DD_RESULT Send()
{
DD_RESULT result = DD_RESULT_SUCCESS;
// Send the test data
while ((result == DD_RESULT_SUCCESS) && (m_totalBytesSent < m_sendDataSize))
{
const void* pData = VoidPtrInc(m_pSendData, m_totalBytesSent);
const size_t bytesToSend = m_sendDataSize - m_totalBytesSent;
size_t bytesSent = 0;
result = ddSocketSendRaw(m_hClientSocket, pData, bytesToSend, kTestTimeoutInMs, &bytesSent);
if (result == DD_RESULT_SUCCESS)
{
m_totalBytesSent += bytesSent;
}
}
return result;
}
DD_RESULT Receive()
{
DD_RESULT result = DD_RESULT_SUCCESS;
// Receive the test data
while ((result == DD_RESULT_SUCCESS) &&
(m_totalBytesReceived < m_totalBytesSent) &&
(m_totalBytesReceived < m_receiveBuffer.Size()))
{
// We should always have more data sent than received in this function
DD_ASSERT(m_totalBytesSent > m_totalBytesReceived);
void* pData = VoidPtrInc(m_receiveBuffer.Data(), m_totalBytesReceived);
const size_t bytesToReceive = m_totalBytesSent - m_totalBytesReceived;
size_t bytesReceived = 0;
result = ddSocketReceiveRaw(m_hServerSocket, pData, bytesToReceive, kTestTimeoutInMs, &bytesReceived);
if (result == DD_RESULT_SUCCESS)
{
m_totalBytesReceived += bytesReceived;
}
}
return result;
}
DD_RESULT ValidateTransfer() const
{
DD_RESULT result = IsTransferComplete() ? DD_RESULT_SUCCESS : DD_RESULT_DD_GENERIC_NOT_READY;
if (result == DD_RESULT_SUCCESS)
{
result = (memcmp(m_pSendData, m_receiveBuffer.Data(), m_sendDataSize) == 0) ? DD_RESULT_SUCCESS : DD_RESULT_PARSING_INVALID_BYTES;
}
return result;
}
DDSocket m_hClientSocket;
DDSocket m_hServerSocket;
const void* m_pSendData;
size_t m_sendDataSize;
size_t m_totalBytesSent;
Vector<uint8_t> m_receiveBuffer;
size_t m_totalBytesReceived;
};
TEST_P(ddSocketSingleThreadedTransferTest, SingleThreadedTransfer)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hServerSocket = DD_API_INVALID_HANDLE;
result = ddSocketAccept(hListenSocket, kTestTimeoutInMs, &hServerSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
// Initialize the test data
DevDriver::Vector<uint8_t> testData(Platform::GenericAllocCb);
testData.Resize(GetParam());
for (size_t byteIndex = 0; byteIndex < testData.Size(); ++byteIndex)
{
testData[byteIndex] = static_cast<uint8_t>(byteIndex % 256);
}
SingleThreadedTransferHelper helper(hClientSocket, hServerSocket);
result = helper.Transfer(testData.Data(), testData.Size());
ASSERT_EQ(result, DD_RESULT_SUCCESS);
ddSocketClose(hServerSocket);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
INSTANTIATE_TEST_CASE_P(
ddSocketTransferTest,
ddSocketSingleThreadedTransferTest,
::testing::Values(1, 4, 8, 64, 4096, 65536, 1024 * 1024)
);
class MultiThreadedTransferHelper
{
public:
MultiThreadedTransferHelper(DDSocket hClientSocket, DDSocket hServerSocket)
: m_hClientSocket(hClientSocket)
, m_hServerSocket(hServerSocket)
, m_pSendData(nullptr)
, m_sendDataSize(0)
, m_receiveBuffer(Platform::GenericAllocCb)
{
}
DD_RESULT Transfer(const void* pData, size_t dataSize)
{
m_pSendData = pData;
m_sendDataSize = dataSize;
m_receiveBuffer.Resize(dataSize);
DD_RESULT result = DevDriverToDDResult(m_receiveThread.Start(ReceiveThreadFunc, this));
if (result == DD_RESULT_SUCCESS)
{
result = Send();
}
if (result == DD_RESULT_SUCCESS)
{
result = DevDriverToDDResult(m_receiveThread.Join(1000));
}
if (result == DD_RESULT_SUCCESS)
{
result = ValidateTransfer();
}
return result;
}
private:
DD_RESULT Send()
{
return ddSocketSend(m_hClientSocket, m_pSendData, m_sendDataSize);
}
void Receive()
{
ddSocketReceive(m_hServerSocket, m_receiveBuffer.Data(), m_receiveBuffer.Size());
}
DD_RESULT ValidateTransfer() const
{
return (memcmp(m_pSendData, m_receiveBuffer.Data(), m_sendDataSize) == 0) ? DD_RESULT_SUCCESS : DD_RESULT_PARSING_INVALID_BYTES;
}
static void ReceiveThreadFunc(void* pUserdata)
{
MultiThreadedTransferHelper* pThis = reinterpret_cast<MultiThreadedTransferHelper*>(pUserdata);
pThis->Receive();
}
DDSocket m_hClientSocket;
DDSocket m_hServerSocket;
const void* m_pSendData;
size_t m_sendDataSize;
Vector<uint8_t> m_receiveBuffer;
Platform::Thread m_receiveThread;
};
TEST_P(ddSocketMultiThreadedTransferTest, MultithreadedTransfer)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hServerSocket = DD_API_INVALID_HANDLE;
result = ddSocketAccept(hListenSocket, kTestTimeoutInMs, &hServerSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
// Initialize the test data
DevDriver::Vector<uint8_t> testData(Platform::GenericAllocCb);
testData.Resize(GetParam());
for (size_t byteIndex = 0; byteIndex < testData.Size(); ++byteIndex)
{
testData[byteIndex] = static_cast<uint8_t>(byteIndex % 256);
}
MultiThreadedTransferHelper helper(hClientSocket, hServerSocket);
result = helper.Transfer(testData.Data(), testData.Size());
ASSERT_EQ(result, DD_RESULT_SUCCESS);
ddSocketClose(hServerSocket);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
INSTANTIATE_TEST_CASE_P(
ddSocketTransferTest,
ddSocketMultiThreadedTransferTest,
::testing::Values(1, 4, 8, 64, 4096, 65536, 1024 * 1024, 4 * 1024 * 1024, 64 * 1024 * 1024)
);
TEST_P(ddSocketVariableChunkSizesTest, BasicTest)
{
DDSocket hListenSocket = DD_API_INVALID_HANDLE;
DDSocketListenInfo listenInfo = {};
listenInfo.hConnection = m_hServerConnection;
listenInfo.protocolId = kTestProtocolId;
listenInfo.maxPending = kTestProtocolMaxPendingConnections;
DD_RESULT result = ddSocketListen(&listenInfo, &hListenSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hClientSocket = DD_API_INVALID_HANDLE;
DDSocketConnectInfo connectInfo = {};
connectInfo.hConnection = m_hClientConnection;
connectInfo.clientId = ddNetQueryClientId(m_hServerConnection);
connectInfo.protocolId = kTestProtocolId;
result = ddSocketConnect(&connectInfo, &hClientSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
DDSocket hServerSocket = DD_API_INVALID_HANDLE;
result = ddSocketAccept(hListenSocket, kTestTimeoutInMs, &hServerSocket);
ASSERT_EQ(result, DD_RESULT_SUCCESS);
constexpr size_t kTestDataSize = 4096;
const size_t readChunkSize = std::get<0>(GetParam());
const size_t writeChunkSize = std::get<1>(GetParam());
DevDriver::Vector<uint8_t> sendData(Platform::GenericAllocCb);
sendData.Resize(kTestDataSize);
for (size_t byteIndex = 0; byteIndex < kTestDataSize; ++byteIndex)
{
sendData[byteIndex] = static_cast<uint8_t>(byteIndex % 256);
}
// NOTE: We assume the send window can hold at least 4k in this test!
size_t totalBytesSent = 0;
while (totalBytesSent < kTestDataSize)
{
const void* pData = VoidPtrInc(sendData.Data(), totalBytesSent);
const size_t bytesToSend = Platform::Min(writeChunkSize, kTestDataSize - totalBytesSent);
size_t bytesSent = 0;
result = ddSocketSendRaw(hClientSocket, pData, bytesToSend, kTestTimeoutInMs, &bytesSent);
if (result == DD_RESULT_SUCCESS)
{
totalBytesSent += bytesSent;
}
else if (result == DD_RESULT_DD_GENERIC_NOT_READY)
{
result = DD_RESULT_SUCCESS;
}
ASSERT_EQ(result, DD_RESULT_SUCCESS);
}
ASSERT_EQ(totalBytesSent, kTestDataSize);
DevDriver::Vector<uint8_t> receiveData(Platform::GenericAllocCb);
receiveData.Resize(kTestDataSize);
size_t totalBytesReceived = 0;
while (totalBytesReceived < kTestDataSize)
{
void* pData = VoidPtrInc(receiveData.Data(), totalBytesReceived);
const size_t bytesToReceive = Platform::Min(readChunkSize, kTestDataSize - totalBytesReceived);
size_t bytesReceived = 0;
result = ddSocketReceiveRaw(hServerSocket, pData, bytesToReceive, kTestTimeoutInMs, &bytesReceived);
if (result == DD_RESULT_SUCCESS)
{
totalBytesReceived += bytesReceived;
}
else if (result == DD_RESULT_DD_GENERIC_NOT_READY)
{
result = DD_RESULT_SUCCESS;
}
ASSERT_EQ(result, DD_RESULT_SUCCESS);
}
ASSERT_EQ(totalBytesReceived, kTestDataSize);
ASSERT_EQ(memcmp(sendData.Data(), receiveData.Data(), kTestDataSize), 0);
ddSocketClose(hServerSocket);
ddSocketClose(hClientSocket);
ddSocketClose(hListenSocket);
}
INSTANTIATE_TEST_CASE_P(
ddSocketVariableChunkSizesTest,
ddSocketVariableChunkSizesTest,
::testing::Values(
std::make_tuple(65536, 32),
std::make_tuple(65536, 64),
std::make_tuple(65536, 4096),
std::make_tuple(65536, 65536),
std::make_tuple(4096, 65536),
std::make_tuple(64, 65536),
std::make_tuple(32, 65536)
)
);
/// GTest entry-point
GTEST_API_ int main(int argc, char** argv)
{
// Run all tests
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 34.045741
| 142
| 0.70864
|
GPUOpen-Drivers
|
c2eab50717a1559fa68a9e8c6751469299518772
| 3,807
|
cpp
|
C++
|
code/msvc/Versity/versity.cpp
|
akrzemi1/Mach7
|
eef288eb9fe59712ff153dd70791365391b7b118
|
[
"BSD-3-Clause"
] | 1,310
|
2015-01-04T03:44:04.000Z
|
2022-03-18T04:44:01.000Z
|
code/msvc/Versity/versity.cpp
|
akrzemi1/Mach7
|
eef288eb9fe59712ff153dd70791365391b7b118
|
[
"BSD-3-Clause"
] | 62
|
2015-01-12T07:59:17.000Z
|
2021-11-14T22:02:14.000Z
|
code/msvc/Versity/versity.cpp
|
akrzemi1/Mach7
|
eef288eb9fe59712ff153dd70791365391b7b118
|
[
"BSD-3-Clause"
] | 108
|
2015-02-13T17:39:07.000Z
|
2021-11-18T11:06:59.000Z
|
//
// Mach7: Pattern Matching Library for C++
//
// Copyright 2011-2013, Texas A&M University.
// Copyright 2014 Yuriy Solodkyy.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the names of Mach7 project nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
///
/// \file
///
/// This file is a part of Mach7 library test suite.
///
/// \author Yuriy Solodkyy <yuriy.solodkyy@gmail.com>
///
/// \see https://parasol.tamu.edu/mach7/
/// \see https://github.com/solodon4/Mach7
/// \see https://github.com/solodon4/SELL
///
#include "versity-types.hpp"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
//------------------------------------------------------------------------------
extern int yyparse(void);
extern int yy_flex_debug;
int yydebug;
//------------------------------------------------------------------------------
int main(int argc, char* argv[])
{
yydebug = 0; // disable Yacc debugging mode
yy_flex_debug = 0; // disable Flex debugging mode
std::string base_name = "undefined";
try
{
if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " filename.i0" << std::endl;
return 1;
}
if (!freopen(argv[1],"r",stdin)) //redirect standard input
{
std::cerr << "Error: Can't open file " << argv[1] << std::endl;
return 2;
}
base_name = argv[1];
base_name.erase(base_name.find_last_of('.'));
int result = yyparse();
std::clog.flush();
if (result == 0)
{
extern instruction_stream_type* instruction_stream;
if (instruction_stream)
{
std::cout << '[';
for (instruction_stream_type::const_iterator p = instruction_stream->begin(); p != instruction_stream->end(); ++p)
std::cout << **p << ',' << std::endl;
std::cout << ']';
}
}
return result;
}
catch (...)
{
std::cerr << "ERROR: Unhandled exception caught while parsing" << std::endl;
return 4;
}
}
//------------------------------------------------------------------------------
| 33.991071
| 131
| 0.57762
|
akrzemi1
|
c2f30b2de6682e61039db5ca962cb08941a559ec
| 21,133
|
cpp
|
C++
|
src/image.cpp
|
trbauer/cls
|
3709dfd2b670c703c0d7d7454c99378cc74dd057
|
[
"MIT"
] | 2
|
2020-05-20T16:56:25.000Z
|
2020-05-27T16:49:43.000Z
|
src/image.cpp
|
trbauer/cls
|
3709dfd2b670c703c0d7d7454c99378cc74dd057
|
[
"MIT"
] | 8
|
2018-12-10T18:34:33.000Z
|
2020-05-19T17:58:43.000Z
|
src/image.cpp
|
trbauer/cls
|
3709dfd2b670c703c0d7d7454c99378cc74dd057
|
[
"MIT"
] | null | null | null |
#include "image.hpp"
#include "system.hpp"
#ifdef USE_LODE_PNG
// up from src and in deps
#include "../deps/lodepng/lodepng.h"
#endif
#ifdef _WIN32
#include <Windows.h>
// #include <Wincodec.h>
#endif
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
uint8_t pixel_value::intensity() const {
return (uint8_t)std::roundf(((float)r + (float)g + (float)b) / 3.0f);
}
image::image()
: bits(nullptr)
, width(0)
, pitch(0)
, height(0)
, alloc_height(0)
, format(data_format::INVALID)
{
}
image::image(size_t w, size_t h, size_t p, enum data_format f)
: pitch(p)
, bits(new uint8_t[pitch * h])
, width(w)
, height(h)
, alloc_height(h)
, format(f)
{
if (p < bytes_per_pixel(f) * w)
FATAL("image::image: pitch is too small for width*bytes-per-pixel");
memset(bits, 0, pitch*alloc_height);
}
image::image(size_t w, size_t h, enum data_format f)
: image(w, h, bytes_per_pixel(f) * w, f) { }
image::~image() {release();}
size_t image::bytes_per_pixel(enum data_format f) {
switch (f) {
case image::I:
return 1;
case image::RGB:
case image::BGR:
return 3;
case image::RGBA:
case image::ARGB:
case image::BGRA:
return 4;
default: FATAL("invalid image format %d", (int)f);
}
}
void image::assign(
const void *imgbits,
size_t w,
size_t h,
enum data_format f,
size_t p,
size_t ah)
{
const size_t bpp = bytes_per_pixel(f);
if (ah < h) {
FATAL("invalid allocation height");
} else if (p < w * bpp) {
FATAL("invalid pitch");
}
release();
format = f;
alloc_height = ah;
width = w;
height = h;
format = f;
pitch = p;
bits = new uint8_t[p * h];
memcpy(bits, imgbits, p * h);
}
void image::assign(const image &rhs) {
assign(
rhs.bits, rhs.width, rhs.height,
rhs.format, rhs.pitch, rhs.alloc_height);
}
image image::convert(enum data_format to) const {
image copy(width, height, to);
size_t pitch_slack = pitch - bytes_per_pixel(format) * width;
size_t copy_pitch_slack = copy.pitch - bytes_per_pixel(to) * copy.width;
unsigned char *ibits = bits;
unsigned char *obits = copy.bits;
for (size_t y = 0; y < height; y++) {
for (size_t x = 0; x < width; x++) {
unsigned char r, g, b, a = 0xFF;
if (format == image::I) {
r = g = b = *ibits++;
} else if (format == image::RGB) {
r = *ibits++;
g = *ibits++;
b = *ibits++;
} else if (format == image::BGR) {
b = *ibits++;
g = *ibits++;
r = *ibits++;
} else if (format == image::RGBA) {
r = *ibits++;
g = *ibits++;
b = *ibits++;
a = *ibits++;
} else if (format == image::ARGB) {
a = *ibits++;
r = *ibits++;
g = *ibits++;
b = *ibits++;
} else if (format == image::BGRA) {
b = *ibits++;
g = *ibits++;
r = *ibits++;
a = *ibits++;
} else {
FATAL("image::convert: invalid format");
}
if (copy.format == image::I) {
uint8_t i =
(uint8_t)roundf((((float)r + (float)g + (float)b)/3.0f));
*obits++ = i;
} else if (copy.format == image::RGB) {
*obits++ = r;
*obits++ = g;
*obits++ = b;
} else if (copy.format == image::BGR) {
*obits++ = b;
*obits++ = g;
*obits++ = r;
} else if (copy.format == image::RGBA) {
*obits++ = r;
*obits++ = g;
*obits++ = b;
*obits++ = a;
} else if (copy.format == image::ARGB) {
*obits++ = a;
*obits++ = r;
*obits++ = g;
*obits++ = b;
} else if (copy.format == image::BGRA) {
*obits++ = b;
*obits++ = g;
*obits++ = r;
*obits++ = a;
} else {
FATAL("image::convert: invalid format");
}
}
ibits += pitch_slack;
memset(obits, 0, copy_pitch_slack);
obits += copy_pitch_slack;
}
return copy;
}
void image::release() {
if (bits)
delete[] bits;
bits = nullptr;
format = image::INVALID;
width = height = pitch = alloc_height = 0;
}
// PPM format http://netpbm.sourceforge.net/doc/ppm.html
//
// EXAMPLE:
// P6
// 640 480
// 255
// [.... binary data RGB,RGB,RGB...]
// [or RRGGBBRRGGBB] if max value >= 256
// EXAMPLE: (not supported yet)
// P3
// # feep.ppm
// 4 4
// 15
// 0 0 0 0 0 0 0 0 0 15 0 15
// 0 0 0 0 15 7 0 0 0 0 0 0
// 0 0 0 0 0 0 0 15 7 0 0 0
// 15 0 15 0 0 0 0 0 0 0 0 0
image *image::load_ppm(const char *file, bool fatal_if_error)
{
#define FAIL(X) \
do { \
if (fatal_if_error) { \
FATAL("image::load_ppm: could not open file"); \
} else { \
return nullptr; \
} \
} while (0)
std::ifstream ifs(file, std::ifstream::binary);
if (!ifs.is_open())
FAIL("image::load_ppm: could not open file");
std::string ln;
while (ifs.peek() == '#')
std::getline(ifs,ln);
if (!std::getline(ifs,ln)) {
FAIL("image::load_ppm: error parsing file");
}
bool is_p6 = ln == "P6";
bool is_p3 = ln == "P3";
if (!is_p6 && !is_p3) {
FAIL("image::load_ppm: error parsing file");
}
while (ifs.peek() == '#')
std::getline(ifs,ln);
int width, height, max_value;
ifs >> width;
ifs >> height;
ifs >> max_value;
size_t off0 = (size_t)ifs.tellg();
while (ifs.peek() == '\n' || ifs.peek() == '\r') {
ifs.get();
}
if (!ifs)
FAIL("image::load_ppm: error parsing image header");
if (max_value <= 0 || width <= 0 || height <= 0)
FAIL("image::load_ppm: invalid image dimensions");
if (max_value > 255)
FAIL("image::load_ppm: only single byte-per-channel images supported");
// size_t data_start = (size_t)ifs.tellg();
image *i = new image(width, height, image::RGB);
if (is_p6) { // binary
ifs.read((char *)i->bits, 3*width*height);
} else { // text
for (int h = 0; h < height; h++) {
for (int w = 0; w < width; w++) {
int r = -1, g = -1, b = -1;
ifs >> r;
if (!ifs || r < 0 || r > max_value)
FAIL("image::load_ppm: error reading pixel");
ifs >> g;
if (!ifs || g < 0 || g > max_value)
FAIL("image::load_ppm: error reading pixel");
ifs >> b;
if (!ifs || b < 0 || b > max_value)
FAIL("image::load_ppm: error reading pixel");
i->bits[h*i->pitch + 3*w + 0] = (uint8_t)r;
i->bits[h*i->pitch + 3*w + 1] = (uint8_t)g;
i->bits[h*i->pitch + 3*w + 2] = (uint8_t)b;
}
}
while (isspace(ifs.peek()))
ifs.get();
}
// size_t data_end = (size_t)ifs.tellg();
if (ifs.get() != EOF) { // can't use ifs.eof()
FAIL("image::load_ppm: expected end of file");
}
return i;
}
void image::save_ppm(const char *file, bool use_binary)
{
if (format != image::RGB) {
image i = image::convert(image::RGB);
i.save_ppm(file,use_binary);
return;
}
if (use_binary) {
std::ofstream ofs(file,std::ostream::binary);
ofs << "P6\n";
ofs << width << " " << height << "\n";
ofs << "255\n";
for (size_t h = 0; h < height; h++)
ofs.write(
(const char *)(bits + h*pitch),
image::bytes_per_pixel(format)*width);
} else {
std::ofstream ofs(file);
ofs << "P3\n";
ofs << width << " " << height << "\n";
ofs << "255\n";
for (size_t h = 0; h < height; h++) {
for (size_t w = 0; w < width; w++) {
if (w > 0)
ofs << " ";
ofs << std::setw(3) << std::setfill(' ') << std::dec <<
(int)bits[h*pitch + 3*w + 0];
ofs << " ";
ofs << std::setw(3) << std::setfill(' ') << std::dec <<
(int)bits[h*pitch + 3*w + 1];
ofs << " ";
ofs << std::setw(3) << std::setfill(' ') << std::dec <<
(int)bits[h*pitch + 3*w + 2];
} // for w
ofs << "\n";
} // for h
}
}
#ifdef IMAGE_HPP_SUPPORTS_BMP
// TODO: Enable cross platform by replacing names below.
// Some testing should be done (hence, why I don't do it now).
//
// for cross platform
struct bitmap_info_header {
uint32_t biSize;
long biWidth;
long biHeight;
uint16_t biPlanes;
uint16_t biBitCount;
uint32_t biCompression;
uint32_t biSizeImage;
long biXPelsPerMeter;
long biYPelsPerMeter;
uint32_t biClrUsed;
uint32_t biClrImportant;
};
// static_assert(sizeof(bitmap_info_header) == sizeof(BITMAPINFOHEADER));
#pragma pack(push,2)
struct bitmap_file_header {
uint16_t bfType;
uint32_t bfSize;
uint16_t bfReserved1;
uint16_t bfReserved2;
uint32_t bfOffBits;
};
#pragma pack(pop)
// static_assert(sizeof(bitmap_file_header) == sizeof(BITMAPFILEHEADER));
// static_assert(offsetof(bitmap_file_header,bfSize) == offsetof(BITMAPFILEHEADER,bfSize));
struct bitmap_info {
bitmap_info_header bmiHeader;
struct {
uint8_t rgbBlue;
uint8_t rgbGreen;
uint8_t rgbRed;
uint8_t rgbReserved;
} bmiColors[1];
};
// static_assert(sizeof(bitmap_info) == sizeof(BITMAPINFO));
static void write_bmp_info_header(
const image &img, BITMAPINFOHEADER &bih)
{
const size_t row_pitch = sys::align_round_up<size_t>(3 * img.width, 4);
bih.biSize = sizeof(bih);
bih.biWidth = (long)img.width;
bih.biHeight = (long)img.height;
bih.biPlanes = 1;
bih.biBitCount = 24; // BGR
bih.biCompression = 0;
bih.biSizeImage = (unsigned long)(row_pitch * img.height);
bih.biXPelsPerMeter = bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0;
bih.biClrImportant = 0;
}
// creates and passes the out_size back
static void *create_bmp_image_data(const image &img, size_t &out_size)
{
const size_t row_pitch = sys::align_round_up<size_t>(3 * img.width, 4);
static const char zeros[4] = { 0, 0, 0, 0 };
const uint8_t *img_bits = img.bits;
const size_t pitch_slack =
img.pitch - image::bytes_per_pixel(img.format) * img.width;
out_size = img.height * row_pitch; // (3 * img.width + out_row_slack);
uint8_t *obuf_base = new uint8_t[out_size];
// bitmaps reverse the row-order
for (size_t y = 1; y <= img.height; y++) {
uint8_t *orow = obuf_base + row_pitch * (img.height - y);
for (size_t x = 0; x < img.width; x++) {
uint8_t r, g, b;
// we force this version here
if (img.format == image::BGR) {
b = *img_bits++;
g = *img_bits++;
r = *img_bits++;
} else {
FATAL("create_bmp_image_data: invalid format");
}
#if 0
// Got rid of this because I kept adding formats and needed a uniform
// approach. From now on, the caller just converts to BGR for us
//
// E.g. BGRA won't work below.
if (img.format == image::I) {
r = g = b = *img_bits++;
} else if (img.format == image::RGB) {
r = *img_bits++;
g = *img_bits++;
b = *img_bits++;
} else if (img.format == image::BGR) {
b = *img_bits++;
g = *img_bits++;
r = *img_bits++;
} else if (img.format == image::RGBA) {
r = *img_bits++;
g = *img_bits++;
b = *img_bits++;
img_bits++;
} else if (img.format == image::ARGB) {
img_bits++;
r = *img_bits++;
g = *img_bits++;
b = *img_bits++;
} else {
FATAL("create_bmp_image_data: invalid format");
}
#endif
// TODO: support intensity images?
// copy out in BGR
*orow++ = b;
*orow++ = g;
*orow++ = r;
}
// set the row pitch slack to 0
for (size_t i = 0; i < row_pitch - 3 * img.width; i++)
*orow++ = 0;
// skip over image pitch slack
img_bits += pitch_slack;
}
return obuf_base;
}
void image::save_bmp(const char *file_name) const
{
if (format != data_format::BGR) {
convert(data_format::BGR).save_bmp(file_name);
return;
}
// We skip the bmiColors table since we don't use it.
// Hence we just store a BITMAPINFOHEADER and ignore the color
// table (included if we correctly used BITMAPINFO)
BITMAPINFOHEADER bih = { 0 };
write_bmp_info_header(*this, bih);
const size_t row_bytes = sys::align_round_up<size_t>(3 * width, 4);
BITMAPFILEHEADER bfh = { 0 };
bfh.bfType = 0x4D42; // "BM"
bfh.bfOffBits = sizeof(bfh)+sizeof(BITMAPINFOHEADER);
bfh.bfSize = bih.biSizeImage + bfh.bfOffBits;
std::ofstream file(file_name, std::ios::binary);
if (!file.is_open()) {
FATAL("image::save_bmp: could not open file");
}
file.write((const char *)&bfh, sizeof(bfh));
// no color table: using BITMAPINFOHEADER
file.write((const char *)&bih, sizeof(BITMAPINFOHEADER));
size_t img_data_bytes;
void *img_data = create_bmp_image_data(*this, img_data_bytes);
file.write((const char *)img_data, img_data_bytes);
delete[] ((uint8_t*)img_data);
}
image *image::load_bmp(const char *file_name, bool fatal_if_error)
{
std::ifstream file(file_name, std::ios::binary);
if (!file.is_open()) {
if (fatal_if_error)
FATAL("%s: failed to open", file_name);
return nullptr;
}
file.seekg(0, std::ios::end);
std::streamoff size = file.tellg();
// std::streamsize size = file.tellg();
// size_t size = file.tellg();
file.seekg(0, std::ios::beg);
std::vector<uint8_t> buffer((size_t)size);
if (!file.read((char *)buffer.data(), size)) {
if (fatal_if_error)
FATAL("%s: failed to read", file_name);
return nullptr;
}
BITMAPFILEHEADER& bfh = (BITMAPFILEHEADER&)buffer[0];
if (bfh.bfType != 0x4D42) {
if (fatal_if_error)
FATAL("%s: not a bitmap file", file_name);
return nullptr;
}
BITMAPINFO& bi = (BITMAPINFO&)buffer[sizeof(BITMAPFILEHEADER)];
BITMAPINFOHEADER& bih = bi.bmiHeader;
if (bih.biCompression != BI_RGB) {
if (fatal_if_error)
FATAL("%s: unsupported format (bih.biCompression != BI_RGB)", file_name);
return nullptr;
}
if (bih.biClrUsed != 0) {
if (fatal_if_error)
FATAL("%s: unsupported format (biClrUsed != 0)", file_name);
return nullptr;
}
if (bih.biClrImportant != 0) {
if (fatal_if_error)
FATAL("%s: unsupported format (biClrImportant != 0)", file_name);
return nullptr;
}
const size_t W = bih.biWidth;
const size_t H = bih.biHeight;
const size_t row_pitch = sys::align_round_up<size_t>(3 * W, 4);
const uint8_t* bitmap_bits =
(const uint8_t *)&buffer[bfh.bfOffBits];
image *img = new image(W, H, image::RGB);
size_t pitch_slack = img->pitch - 3 * img->width;
uint8_t *imgbits = img->bits;
// Bitmaps put rows in reverse order. Hence, row[0] is really row[h - 1].
// We simply read the rows out backwards to fix this.
for (size_t y = 1; y <= H; y++) {
const uint8_t *row_bits = bitmap_bits + (H - y) * row_pitch;
for (size_t x = 0; x < W; x++) {
uint8_t b = *row_bits++;
uint8_t g = *row_bits++;
uint8_t r = *row_bits++;
// default format is RGB-24 bit
*imgbits++ = r;
*imgbits++ = g;
*imgbits++ = b;
}
// zero the pitch slack and move the ptr
memset(imgbits, 0, pitch_slack);
imgbits += pitch_slack;
}
return img;
}
#endif
#ifdef USE_LODE_PNG
image *image::load_png(const char *file, bool fatal_if_error)
{
std::vector<unsigned char> bits; //the raw pixels
unsigned width = 0, height = 0;
auto err = lodepng::decode(bits, width, height, file);
if (err) {
auto err_str = lodepng_error_text(err);
if (fatal_if_error)
FATAL("%s: failed to decode PNG: %s",file,err_str);
else
return nullptr;
}
// the pixels are now in the vector "image", 4 bytes per pixel RGBARGBA....
image *i = new image(width, height, data_format::RGBA);
if (!bits.empty())
memcpy(i->bits, bits.data(), 4*width*height);
return i;
}
void image::save_png(const char *file) const
{
if (format != data_format::RGBA || pitch != 4*width) {
convert(data_format::RGBA).save_png(file);
return;
}
auto err =
lodepng_encode32_file(file, bits, (unsigned)width, (unsigned)height);
if (err) {
FATAL("%s: failed to write PNG (%s)",file,lodepng_error_text(err));
}
}
#endif
void image::resize(
size_t new_width,
size_t new_height,
struct pixel_value fill)
{
size_t old_height = height;
size_t old_width = width;
width = new_width;
height = new_height;
const size_t bytes_per_px = bytes_per_pixel(format);
if (bytes_per_px * new_width <= pitch && new_height <= alloc_height) {
// new width fits within the old pitch and allocation height
const size_t new_pitch_slack = pitch - bytes_per_px * new_width;
// clear the ends of the rows
for (size_t y = 0; y < new_height; y++) {
uint8_t *row_tail = bits + y * pitch + new_width * bytes_per_px;
memset(row_tail, 0, new_pitch_slack);
}
if (new_height <= old_height) {
// height got smaller, clear the truncated rows
memset(
bits + pitch * new_height,
0,
(old_height - new_height) * pitch);
} else {
// expanded height: initialize the new height to fill
for (size_t y = old_height; y < new_height; y++) {
uint8_t *row = bits + pitch * y;
for (size_t x = 0; x < new_width; x++) {
if (format == image::I) {
*row++ = fill.intensity();
} else if (format == image::RGB) {
*row++ = fill.r;
*row++ = fill.g;
*row++ = fill.b;
} else if (format == image::BGR) {
*row++ = fill.b;
*row++ = fill.g;
*row++ = fill.r;
} else if (format == image::RGBA) {
*row++ = fill.r;
*row++ = fill.g;
*row++ = fill.b;
*row++ = fill.a;
} else if (format == image::ARGB) {
*row++ = fill.a;
*row++ = fill.r;
*row++ = fill.g;
*row++ = fill.b;
} else {
FATAL("INTERNAL: image::resize: unexpected format");
}
}
// clear the tail
memset(row, 0, new_pitch_slack);
}
}
} else {
// new size is too large, copy needed
const size_t old_pitch = pitch;
if (bytes_per_px * new_width > pitch)
pitch = bytes_per_px * new_width;
if (new_height > alloc_height)
alloc_height = new_height;
uint8_t *old_bits = bits;
bits = new uint8_t[pitch * alloc_height * 3];
size_t copy_h = new_height > old_height ? old_height : new_height;
size_t copy_w = new_width > old_width ? old_width : new_width;
size_t y;
for (y = 0; y < copy_h; y++) {
uint8_t *old_row = old_bits + old_pitch * y;
uint8_t *new_row = bits + pitch * y;
if (new_width >= old_width) {
// copy old pixels
memcpy(new_row, old_row, bytes_per_px * old_width);
// set new pixels to fill
for (size_t x = old_width; x < new_width; x++) {
if (format == image::I) {
*new_row++ = fill.intensity();
} else if (format == image::RGB) {
*new_row++ = fill.r;
*new_row++ = fill.g;
*new_row++ = fill.b;
} else if (format == image::BGR) {
*new_row++ = fill.b;
*new_row++ = fill.g;
*new_row++ = fill.r;
} else if (format == image::RGBA) {
*new_row++ = fill.r;
*new_row++ = fill.g;
*new_row++ = fill.b;
*new_row++ = fill.a;
} else if (format == image::ARGB) {
*new_row++ = fill.a;
*new_row++ = fill.r;
*new_row++ = fill.g;
*new_row++ = fill.b;
} else {
FATAL("image::resize: unexpected format");
}
}
} else { // new_width < old_width
// copy old
memcpy(new_row, old_row, 3 * new_width);
// no new fill
}
// zero slack
memset(new_row + 3 * new_width, 0, pitch - bytes_per_px * new_width);
} // for copy_h
// handle potential new height that needs filling
for (; y < old_height; y++) {
uint8_t *new_row = bits + bytes_per_px * y;
for (size_t x = 0; x < new_width; x++) {
if (format == image::I) {
*new_row++ = fill.intensity();
} else if (format == image::RGB) {
*new_row++ = fill.r;
*new_row++ = fill.g;
*new_row++ = fill.b;
} else if (format == image::BGR) {
*new_row++ = fill.b;
*new_row++ = fill.g;
*new_row++ = fill.r;
} else if (format == image::RGBA) {
*new_row++ = fill.r;
*new_row++ = fill.g;
*new_row++ = fill.b;
*new_row++ = fill.a;
} else if (format == image::ARGB) {
*new_row++ = fill.a;
*new_row++ = fill.r;
*new_row++ = fill.g;
*new_row++ = fill.b;
} else {
FATAL("image::resize: unexpected format");
}
}
// zero slack
memset(new_row + 3 * new_width, 0, pitch - bytes_per_px * new_width);
}
// zero the rest of the allocation height
memset(
bits + pitch * new_height,
0,
(alloc_height - new_height) * pitch);
delete[] old_bits;
}
}
| 28.989026
| 91
| 0.559362
|
trbauer
|
c2f8dc920bffb4c7ad64de06db5abec5dc3d4101
| 24,946
|
cc
|
C++
|
src/ascii_network_parser.cc
|
motis-project/rapid
|
3b18e9a8169b663db891fe5de49ff5da2627e589
|
[
"MIT"
] | 1
|
2020-08-05T08:38:43.000Z
|
2020-08-05T08:38:43.000Z
|
src/ascii_network_parser.cc
|
motis-project/rapid
|
3b18e9a8169b663db891fe5de49ff5da2627e589
|
[
"MIT"
] | 1
|
2020-07-26T19:44:28.000Z
|
2020-07-26T19:44:28.000Z
|
src/ascii_network_parser.cc
|
motis-project/rapid
|
3b18e9a8169b663db891fe5de49ff5da2627e589
|
[
"MIT"
] | null | null | null |
#include "soro/ascii_network_parser.h"
#include <cassert>
#include <iostream>
#include <optional>
#include <sstream>
#include "cista/containers/hash_map.h"
#include "cista/containers/hash_set.h"
#include "cista/containers/pair.h"
#include "cista/containers/variant.h"
#include "utl/enumerate.h"
#include "utl/erase_if.h"
#include "utl/overloaded.h"
#include "utl/parser/arg_parser.h"
#include "utl/parser/cstr.h"
#include "utl/pipes.h"
#include "utl/verify.h"
namespace soro {
namespace cr = cista::raw;
struct ascii_network_parser {
using map_el_t = cr::variant<node*, edge*>;
enum type : char {
EMPTY = ' ',
// Tracks.
HORIZONTAL = '=',
VERTICAL = '|',
DIAGONAL_LR = '\\',
DIAGONAL_RL = '/',
// Signal direction indicators.
DIRECTION_RIGHT = '>',
DIRECTION_LEFT = '<',
DIRECTION_TOP = ';',
DIRECTION_BOTTOM = '!',
// End of train detectors.
END_OF_TRAIN_DETECTOR = '%',
END_OF_TRAIN_DETECTOR_L = '[',
END_OF_TRAIN_DETECTOR_R = ']',
// Approach signals.
APPROACH_SIGNAL_L = '(',
APPROACH_SIGNAL_R = ')',
// Direction change / switch
KNOT = '*',
// Level junction (no difference)
LEVEL_JUNCTION = '#',
LEVEL_JUNCTION_ALT = 'X',
// Single slip switch.
SINGLE_SLIP = '^',
SINGLE_SLIP_INVERTED = 'v'
};
enum class dir {
TOP_LEFT,
TOP,
TOP_RIGHT,
LEFT,
RIGHT,
BOTTOM_LEFT,
BOTTOM,
BOTTOM_RIGHT
};
struct signal_info {
type direction_;
std::vector<pixel_pos> positions_;
};
static constexpr pixel_pos next(pixel_pos const p, dir const d) {
switch (d) {
case dir::TOP_LEFT: return {p.x_ - 1, p.y_ - 1};
case dir::TOP: return {p.x_, p.y_ - 1};
case dir::TOP_RIGHT: return {p.x_ + 1, p.y_ - 1};
case dir::LEFT: return {p.x_ - 1, p.y_};
case dir::RIGHT: return {p.x_ + 1, p.y_};
case dir::BOTTOM_LEFT: return {p.x_ - 1, p.y_ + 1};
case dir::BOTTOM: return {p.x_, p.y_ + 1};
case dir::BOTTOM_RIGHT: return {p.x_ + 1, p.y_ + 1};
}
assert(false);
return p;
}
static constexpr type get_orientation(dir const d) {
switch (d) {
case dir::TOP_LEFT: [[fallthrough]];
case dir::BOTTOM_RIGHT: return DIAGONAL_LR;
case dir::TOP_RIGHT: [[fallthrough]];
case dir::BOTTOM_LEFT: return DIAGONAL_RL;
case dir::TOP: [[fallthrough]];
case dir::BOTTOM: return VERTICAL;
case dir::LEFT: [[fallthrough]];
case dir::RIGHT: return HORIZONTAL;
}
assert(false);
return HORIZONTAL;
}
static constexpr bool is_diagonal(dir const d) {
switch (d) {
case dir::TOP_LEFT:
case dir::BOTTOM_RIGHT:
case dir::TOP_RIGHT: [[fallthrough]];
case dir::BOTTOM_LEFT: return true;
default: return false;
}
assert(false);
return false;
}
template <typename Fn>
static constexpr void for_each_opposite(dir const d, Fn&& f) {
switch (d) {
case dir::TOP_LEFT:
f(dir::BOTTOM);
f(dir::BOTTOM_RIGHT);
f(dir::RIGHT);
break;
case dir::TOP:
f(dir::BOTTOM_LEFT);
f(dir::BOTTOM);
f(dir::BOTTOM_RIGHT);
break;
case dir::TOP_RIGHT:
f(dir::LEFT);
f(dir::BOTTOM_LEFT);
f(dir::BOTTOM);
break;
case dir::RIGHT:
f(dir::TOP_LEFT);
f(dir::LEFT);
f(dir::BOTTOM_LEFT);
break;
case dir::BOTTOM_RIGHT:
f(dir::LEFT);
f(dir::TOP_LEFT);
f(dir::TOP);
break;
case dir::BOTTOM:
f(dir::TOP_LEFT);
f(dir::TOP);
f(dir::TOP_RIGHT);
break;
case dir::BOTTOM_LEFT:
f(dir::TOP);
f(dir::TOP_RIGHT);
f(dir::RIGHT);
break;
case dir::LEFT:
f(dir::TOP_RIGHT);
f(dir::RIGHT);
f(dir::BOTTOM_RIGHT);
break;
}
}
static constexpr dir get_opposite(dir const d) {
switch (d) {
case dir::LEFT: return dir::RIGHT;
case dir::RIGHT: return dir::LEFT;
case dir::TOP: return dir::BOTTOM;
case dir::BOTTOM: return dir::TOP;
case dir::TOP_LEFT: return dir::BOTTOM_RIGHT;
case dir::BOTTOM_RIGHT: return dir::TOP_LEFT;
case dir::BOTTOM_LEFT: return dir::TOP_RIGHT;
case dir::TOP_RIGHT: return dir::BOTTOM_LEFT;
}
assert(false);
return d;
}
explicit ascii_network_parser(std::string_view s)
: lines_{begin(utl::lines{s}), end(utl::lines{s})} {}
network parse() {
for (auto const [y, l] : utl::enumerate(lines_)) {
if (l.starts_with("#")) {
curr_station_ =
net_.stations_.emplace_back(std::make_unique<station>()).get();
auto mut_line = l;
mut_line >> curr_station_->id_ >> curr_station_->name_;
continue;
}
for (auto const [x, c] : utl::enumerate(l)) {
if (curr_station_ == nullptr) {
curr_station_ =
net_.stations_.emplace_back(std::make_unique<station>()).get();
curr_station_->name_ = "dummy";
}
auto const p = pixel_pos{static_cast<pixel_coord_t>(x),
static_cast<pixel_coord_t>(y)};
digit_ = 0U;
switch (c) {
case HORIZONTAL:
case VERTICAL:
case DIAGONAL_LR: [[fallthrough]];
case DIAGONAL_RL: do_edge(p, static_cast<type>(c)); break;
case KNOT: do_knot(p); break;
case LEVEL_JUNCTION_ALT: [[fallthrough]];
case LEVEL_JUNCTION: do_level_junction(p); break;
case DIRECTION_TOP:
case DIRECTION_BOTTOM:
case DIRECTION_LEFT: [[fallthrough]];
case DIRECTION_RIGHT:
do_main_signal(p, static_cast<type>(c), true);
break;
case SINGLE_SLIP: [[fallthrough]];
case SINGLE_SLIP_INVERTED: do_single_slip(p, c); break;
case END_OF_TRAIN_DETECTOR_R:
case END_OF_TRAIN_DETECTOR_L: [[fallthrough]];
case END_OF_TRAIN_DETECTOR: do_eotd(p, c); break;
case APPROACH_SIGNAL_L:
do_directional_node(p, dir::RIGHT, dir::LEFT,
node::type::APPROACH_SIGNAL, c);
break;
case APPROACH_SIGNAL_R:
do_directional_node(p, dir::LEFT, dir::RIGHT,
node::type::APPROACH_SIGNAL, c);
break;
default:
if (std::isdigit(c) != 0) {
do_digit(p, static_cast<unsigned>(c - '0'));
} else if (c >= 'a' && c <= 'z') {
do_end_node(p, c);
} else if (std::isalpha(c) != 0) {
do_main_signal(p, static_cast<type>(c), false);
}
}
}
}
connect_level_junctions();
connect_switches();
connect_single_slip_switches();
connect_signals();
connect_directionals();
connect_edges();
connect_eotds();
return std::move(net_);
}
template <typename Fn>
void for_each_neighbor_pos(pixel_pos const p, Fn&& fn) {
auto const call = [&](dir const d) {
if (auto const neighbor_pos = next(p, d);
is_valid_and_non_empty(neighbor_pos)) {
fn(neighbor_pos, d);
}
};
call(dir::TOP);
call(dir::BOTTOM);
call(dir::LEFT);
call(dir::RIGHT);
call(dir::TOP_LEFT);
call(dir::BOTTOM_RIGHT);
call(dir::TOP_RIGHT);
call(dir::BOTTOM_LEFT);
}
template <typename T, typename Fn>
void for_each_neighbor(pixel_pos const p, Fn&& fn) {
for_each_neighbor_pos(p, [&](pixel_pos const neighbor_pos, dir const d) {
auto const neighbor = get_map_el(neighbor_pos, get_orientation(d));
if (neighbor.has_value() && cista::holds_alternative<T*>(*neighbor)) {
fn(cista::get<T*>(*neighbor), d);
}
});
}
bool is_valid_and_non_empty(pixel_pos const p) const {
return p.valid() && static_cast<size_t>(p.y_) < lines_.size() &&
static_cast<size_t>(p.x_) < lines_[p.y_].len &&
lines_[p.y_][0] != '#' && lines_[p.y_][p.x_] != EMPTY;
}
std::optional<char> get_char(pixel_pos const p) const {
return is_valid_and_non_empty(p) ? std::make_optional(lines_[p.y_][p.x_])
: std::nullopt;
}
std::optional<map_el_t> get_map_el(pixel_pos const p,
type const orientation) {
if (auto const it1 = map_.find(p); it1 != end(map_)) {
if (auto const it2 = it1->second.find(orientation);
it2 != end(it1->second)) {
return it2->second;
}
if (auto const it2 = it1->second.find(KNOT); it2 != end(it1->second)) {
return it2->second;
}
}
return std::nullopt;
}
void do_digit(pixel_pos const p, unsigned digit) {
digit_ = digit;
cr::hash_map<type, edge*> els;
for_each_neighbor_pos(p, [&](pixel_pos const neighbor_pos, dir const d) {
auto const neighbor_char = get_char(neighbor_pos);
if (*neighbor_char == get_orientation(d) ||
std::isdigit(*neighbor_char) != 0) {
auto const neighbor = get_map_el(neighbor_pos, get_orientation(d));
if (auto const it = els.find(get_orientation(d));
it == end(els) || it->second == nullptr) {
els[get_orientation(d)] =
neighbor.has_value() && cista::holds_alternative<edge*>(*neighbor)
? cista::get<edge*>(*neighbor)
: nullptr;
}
}
});
utl::verify(els.size() == 1, "num {} {}x connected", p, els.size());
auto const [orientation, e] = *els.begin();
do_edge(p, orientation, map_el_t{e});
}
void do_edge(pixel_pos const pos, type const orientation) {
pixel_pos pred_pos;
switch (orientation) {
case HORIZONTAL: pred_pos = next(pos, dir::LEFT); break;
case VERTICAL: pred_pos = next(pos, dir::TOP); break;
case DIAGONAL_RL: pred_pos = next(pos, dir::TOP_RIGHT); break;
case DIAGONAL_LR: pred_pos = next(pos, dir::TOP_LEFT); break;
default: assert(false);
}
auto const el_at_pos = get_map_el(pred_pos, orientation);
do_edge(pos, orientation,
el_at_pos.has_value() ? *el_at_pos
: map_el_t{static_cast<edge*>(nullptr)});
}
void do_edge(pixel_pos const pos, type const orientation, map_el_t pred) {
edge* e{cista::holds_alternative<edge*>(pred) ? cista::get<edge*>(pred)
: nullptr};
if (e == nullptr) {
e = net_.edges_.emplace_back(std::make_unique<edge>()).get();
}
e->draw_representation_.emplace_back(pos, static_cast<char>(orientation));
e->dist_ += 1;
e->id_ = digit_ == 0 ? e->id_ : e->id_ * 10 + digit_;
map_[pos][orientation] = e;
}
bool is_edge(pixel_pos const pos) const {
auto const c = get_char(pos);
return c.has_value() && (*c == HORIZONTAL || *c == VERTICAL ||
*c == DIAGONAL_RL || *c == DIAGONAL_LR);
}
void do_knot(pixel_pos const p) {
auto neighbor_edges{0U};
auto built_edge_positions{0U};
cr::hash_set<edge*> edges;
for_each_neighbor_pos(p, [&](pixel_pos const pos, dir const d) {
auto const el = get_map_el(pos, get_orientation(d));
neighbor_edges += static_cast<unsigned>(is_edge(pos));
built_edge_positions += static_cast<unsigned>(el.has_value());
if (el.has_value() && cista::holds_alternative<edge*>(*el)) {
edges.emplace(cista::get<edge*>(*el));
}
});
if (neighbor_edges < 3U) {
// ### JUST A CORNER (NOT A SWITCH)
if (built_edge_positions == 2) {
// Two predecessors need to be handled specially.
if (edges.size() == 1) {
// The same edge from two directions. This is a circle!
// Let's celebrate this with a new node.
auto const n =
net_.nodes_.emplace_back(std::make_unique<node>()).get();
auto const e = *edges.begin();
n->traversals_[e].emplace(e);
n->draw_representation_.emplace_back(p, KNOT);
e->from_ = e->to_ = n;
} else /* edges.size() == 2 */ {
// We have built one edge too many. We need to let one go.
// Happens with _| forms.
auto const good = *edges.begin();
auto const bad = *std::next(edges.begin());
good->draw_representation_.insert(begin(good->draw_representation_),
begin(bad->draw_representation_),
end(bad->draw_representation_));
good->dist_ += bad->dist_;
good->id_ = good->id_ != 0U ? good->id_ : bad->id_;
utl::erase_if(net_.edges_, [&](auto&& e) { return e.get() == bad; });
for (auto& [pos, els] : map_) {
for (auto& [orientation, el] : els) {
el.apply(utl::overloaded{
[&](edge*& e) { e = (e == bad) ? good : e; }});
}
}
edges.erase(std::next(edges.begin()));
}
}
// Connect to existing edge if possible. Else, just build a new one.
do_edge(p, KNOT,
edges.empty() ? map_el_t{static_cast<edge*>(nullptr)}
: map_el_t{*edges.begin()});
} else {
// ### SWITCH
auto const n = net_.nodes_.emplace_back(std::make_unique<node>()).get();
n->draw_representation_.emplace_back(p, KNOT);
n->type_ = node::type::SWITCH;
map_[p][KNOT] = n;
}
}
void do_eotd(pixel_pos const p, char const type) {
auto const n = net_.nodes_.emplace_back(std::make_unique<node>()).get();
n->name_ = fmt::format("EOTD{}_{}", p.x_, p.y_);
n->draw_representation_.emplace_back(p, type);
n->type_ = node::type::END_OF_TRAIN_DETECTOR;
map_[p][KNOT] = n;
}
void do_level_junction(pixel_pos const p) {
auto const n = net_.nodes_.emplace_back(std::make_unique<node>()).get();
n->draw_representation_.emplace_back(p, LEVEL_JUNCTION);
n->type_ = node::type::LEVEL_JUNCTION;
map_[p][KNOT] = n;
}
void do_single_slip(pixel_pos const p, char const type) {
auto const n = net_.nodes_.emplace_back(std::make_unique<node>()).get();
n->draw_representation_.emplace_back(p, static_cast<char>(type));
n->type_ = node::type::SINGLE_SLIP_SWITCH;
map_[p][KNOT] = n;
}
void do_directional_node(pixel_pos const p, dir const from, dir const to,
node::type const type, char const content) {
auto const n = net_.nodes_.emplace_back(std::make_unique<node>()).get();
n->type_ = type;
n->draw_representation_.emplace_back(p, content);
dir_[n] = {p, from, to};
map_[p][KNOT] = n;
}
void do_main_signal(pixel_pos const p, type representation,
bool const is_dir) {
// Search for existing adjacent part of the signal name.
node* signal{nullptr};
type signal_orientation{KNOT};
for_each_neighbor_pos(p, [&](pixel_pos const neighbor_pos, dir const d) {
if (auto const it1 = map_.find(neighbor_pos); it1 != end(map_)) {
if (auto const it2 = it1->second.find(get_orientation(d));
it2 != end(it1->second)) {
if (cista::holds_alternative<node*>(it2->second) &&
cista::get<node*>(it2->second)->type_ ==
node::type::MAIN_SIGNAL) {
signal = cista::get<node*>(it2->second);
signal_orientation = get_orientation(d);
} else if (cista::holds_alternative<edge*>(it2->second)) {
signal_orientation = get_orientation(d);
}
}
}
});
utl::verify(signal_orientation != KNOT, "signal {} has no neighbor", p);
if (signal == nullptr) {
signal = net_.nodes_.emplace_back(std::make_unique<node>()).get();
signal->type_ = node::type::MAIN_SIGNAL;
}
map_[p][signal_orientation] = map_el_t{signal};
auto& signal_info = signal_info_[signal];
signal_info.positions_.emplace_back(p);
if (is_dir) {
signal_info.direction_ = representation;
} else {
signal->name_ += static_cast<char>(representation);
}
signal->draw_representation_.emplace_back(
p, static_cast<char>(representation));
}
void do_end_node(pixel_pos const p, char c) {
auto const n = net_.nodes_.emplace_back(std::make_unique<node>()).get();
n->type_ = node::type::END_NODE;
n->draw_representation_.emplace_back(p, c);
n->name_ = c;
map_[p][KNOT] = map_el_t{n};
}
void connect_switches() {
for (auto const& [p, el] : map_) {
auto const pos = p;
if (el.size() != 1U ||
!cista::holds_alternative<node*>(begin(el)->second)) {
continue;
}
auto const n = cista::get<node*>(begin(el)->second);
if (n->type_ != node::type::SWITCH) {
continue;
}
for_each_neighbor<edge>(pos, [&](edge* e, dir const d) {
for_each_opposite(d, [&](dir const opposite_dir) {
if (auto const opposite_el = get_map_el(
next(pos, opposite_dir), get_orientation(opposite_dir));
opposite_el.has_value() &&
cista::holds_alternative<edge*>(*opposite_el)) {
auto const opposite_e = cista::get<edge*>(*opposite_el);
n->traversals_[e].emplace(opposite_e);
n->traversals_[opposite_e].emplace(e);
}
});
});
}
}
std::pair<edge*, type> get_edge(pixel_pos const p,
std::initializer_list<dir> directions) {
edge* e{nullptr};
type orientation{KNOT};
for (auto const dir : directions) {
auto const el = get_map_el(next(p, dir), get_orientation(dir));
if (!el.has_value()) {
continue;
}
utl::verify(cista::holds_alternative<edge*>(*el),
"single slip neighbor {} not an edge", next(p, dir));
utl::verify(e == nullptr, "double edge");
e = cista::get<edge*>(*el);
orientation = get_orientation(dir);
}
utl::verify(e != nullptr, "single slip {} edge missing {}", p,
*directions.begin());
return std::pair{e, orientation};
}
void connect_single_slip_switches() {
for (auto const& [p, el] : map_) {
auto const pos = p;
if (el.size() != 1U ||
!cista::holds_alternative<node*>(begin(el)->second)) {
continue;
}
auto const n = cista::get<node*>(begin(el)->second);
if (n->type_ != node::type::SINGLE_SLIP_SWITCH) {
continue;
}
auto const [left, left_dir] = get_edge(pos, {dir::LEFT});
auto const [right, right_dir] = get_edge(pos, {dir::RIGHT});
auto const [bottom, bottom_dir] =
get_edge(pos, {dir::BOTTOM_LEFT, dir::BOTTOM, dir::BOTTOM_RIGHT});
auto const [top, top_dir] =
get_edge(pos, {dir::TOP_LEFT, dir::TOP, dir::TOP_RIGHT});
utl::verify(bottom_dir == top_dir,
"single slip {} bottom/top orientation mismatch", p);
n->traversals_[left].emplace(right);
n->traversals_[right].emplace(left);
n->traversals_[top].emplace(bottom);
n->traversals_[bottom].emplace(top);
if (n->draw_representation_[0].content_ == SINGLE_SLIP) {
if (top_dir == DIAGONAL_RL) {
n->traversals_[left].emplace(top);
n->traversals_[top].emplace(left);
} else if (top_dir == DIAGONAL_LR) {
n->traversals_[right].emplace(top);
n->traversals_[top].emplace(right);
}
} else {
if (top_dir == DIAGONAL_RL) {
n->traversals_[right].emplace(top);
n->traversals_[bottom].emplace(right);
} else if (top_dir == DIAGONAL_LR) {
n->traversals_[left].emplace(bottom);
n->traversals_[bottom].emplace(left);
}
}
}
}
void connect_eotds() {
for (auto const& [p, el] : map_) {
auto const pos = p;
if (el.size() != 1U ||
!cista::holds_alternative<node*>(begin(el)->second)) {
continue;
}
auto const n = cista::get<node*>(begin(el)->second);
if (n->type_ != node::type::END_OF_TRAIN_DETECTOR) {
continue;
}
auto orientation = KNOT;
for_each_neighbor<edge>(p, [&](edge* e, dir const d) {
utl::verify(
get_orientation(d) == orientation || orientation == KNOT,
"too many orientations for end of train connector at {}: {} and {}",
orientation, get_orientation(d));
auto const opposite_e =
get_edge(next(pos, get_opposite(d)), get_orientation(d));
n->traversals_[e].emplace(opposite_e);
n->traversals_[opposite_e].emplace(e);
switch (n->draw_representation_.front().content_) {
case END_OF_TRAIN_DETECTOR:
n->action_traversal_[e] = opposite_e;
n->action_traversal_[opposite_e] = e;
break;
case END_OF_TRAIN_DETECTOR_L:
if (d == dir::RIGHT) {
n->action_traversal_[e] = opposite_e;
}
break;
case END_OF_TRAIN_DETECTOR_R:
if (d == dir::LEFT) {
n->action_traversal_[e] = opposite_e;
}
break;
default: assert(false);
}
orientation = get_orientation(d);
});
utl::verify(orientation != KNOT, "eotd at {} has no neighbors", p);
}
}
void connect_level_junctions() {
for (auto const& [p, el] : map_) {
auto const pos = p;
if (el.size() != 1U ||
!cista::holds_alternative<node*>(begin(el)->second)) {
continue;
}
auto const n = cista::get<node*>(begin(el)->second);
if (n->type_ != node::type::LEVEL_JUNCTION) {
continue;
}
for_each_neighbor<edge>(p, [&](edge* e, dir const d) {
auto const opposite_e =
get_edge(next(pos, get_opposite(d)), get_orientation(d));
n->traversals_[e].emplace(opposite_e);
n->traversals_[opposite_e].emplace(e);
});
}
}
void connect_signals() {
for (auto const& [signal, info] : signal_info_) {
pixel_pos pos;
cr::hash_map<dir, edge*> neighbors;
for (auto const& p : info.positions_) {
pos = p;
for_each_neighbor<edge>(
p, [&](edge* e, dir const d) { neighbors.emplace(d, e); });
}
edge *from{nullptr}, *to{nullptr};
switch (info.direction_) {
case DIRECTION_RIGHT:
from = neighbors.at(dir::LEFT);
to = neighbors.at(dir::RIGHT);
break;
case DIRECTION_LEFT:
from = neighbors.at(dir::RIGHT);
to = neighbors.at(dir::LEFT);
break;
case DIRECTION_TOP:
from = neighbors.at(dir::BOTTOM);
to = neighbors.at(dir::TOP);
break;
case DIRECTION_BOTTOM:
from = neighbors.at(dir::TOP);
to = neighbors.at(dir::BOTTOM);
break;
default: utl::verify(false, "signal {}: bad direction", pos);
}
utl::verify(from != nullptr, "signal {} from not found", pos);
utl::verify(to != nullptr, "signal {} to not found", pos);
signal->action_traversal_[from] = to;
signal->traversals_[from].emplace(to);
signal->traversals_[to].emplace(from);
}
}
edge* get_edge(pixel_pos const p, type const orientation) {
auto const e = get_map_el(p, orientation);
utl::verify(e.has_value(), "{} is empty but should be an edge");
utl::verify(cista::holds_alternative<edge*>(*e), "{} is not an edge", p);
return cista::get<edge*>(*e);
}
void connect_directionals() {
for (auto const& [n, info] : dir_) {
auto const [pos, from, to] = info;
auto const from_edge = get_edge(next(pos, from), get_orientation(from));
auto const to_edge = get_edge(next(pos, to), get_orientation(to));
n->traversals_[from_edge].emplace(to_edge);
n->traversals_[to_edge].emplace(from_edge);
n->action_traversal_[from_edge] = to_edge;
}
}
void connect_edges() {
for (auto const& [pos, els] : map_) {
for (auto const& [orientation, el] : els) {
if (!cista::holds_alternative<node*>(el)) {
continue;
}
auto const n = cista::get<node*>(el);
for_each_neighbor<edge>(pos, [&](edge* e, dir const) {
e->add_node(n);
if (n->type_ == node::type::END_NODE) {
n->end_node_edge_ = e;
}
});
}
}
}
std::vector<utl::cstr> lines_;
cr::hash_map<pixel_pos, cr::hash_map<type /* orientation */, map_el_t>> map_;
cr::hash_map<node*, signal_info> signal_info_;
cr::hash_map<node*, std::tuple<pixel_pos, dir, dir>> dir_;
unsigned digit_{0U};
station* curr_station_{nullptr};
network net_;
};
network parse_network(std::string_view str) {
return ascii_network_parser{str}.parse();
}
} // namespace soro
| 32.023107
| 80
| 0.572076
|
motis-project
|
6c060efa119513d0ddf4f441ba263fbb6384c4e9
| 529
|
cpp
|
C++
|
Console3D/Source/Scene/Scene.cpp
|
l3ch4tno1r/Console3D
|
acb6b92555e01b8ada31cd426753b3a671a6afdd
|
[
"Apache-2.0"
] | 3
|
2020-11-01T18:17:26.000Z
|
2021-03-19T21:40:50.000Z
|
Console3D/Source/Scene/Scene.cpp
|
l3ch4tno1r/Console3D
|
acb6b92555e01b8ada31cd426753b3a671a6afdd
|
[
"Apache-2.0"
] | null | null | null |
Console3D/Source/Scene/Scene.cpp
|
l3ch4tno1r/Console3D
|
acb6b92555e01b8ada31cd426753b3a671a6afdd
|
[
"Apache-2.0"
] | null | null | null |
#include <cmath>
#include "Scene.h"
#include "Entity.h"
#include "StdComponent.h"
#include "Console3D/Source/Core/Console.h"
namespace LCN
{
Entity Scene::Create2DEntity()
{
Entity result = { m_Registry.create(), this };
result.Add<Component::Transform2DCmp>();
return result;
}
Entity Scene::Create3DEntity()
{
Entity result = { m_Registry.create(), this };
result.Add<Component::Transform3DCmp>();
return result;
}
void Scene::DestroyEntity(Entity entity)
{
m_Registry.destroy(entity);
}
}
| 15.114286
| 48
| 0.688091
|
l3ch4tno1r
|
6c08f9a8b0f49d4dc8f881d1dc8346562b67410d
| 4,663
|
cpp
|
C++
|
test/test_tensor.cpp
|
kthur/he-transformer
|
5d3294473edba10f2789197043b8d8704409719e
|
[
"Apache-2.0"
] | null | null | null |
test/test_tensor.cpp
|
kthur/he-transformer
|
5d3294473edba10f2789197043b8d8704409719e
|
[
"Apache-2.0"
] | null | null | null |
test/test_tensor.cpp
|
kthur/he-transformer
|
5d3294473edba10f2789197043b8d8704409719e
|
[
"Apache-2.0"
] | null | null | null |
//*****************************************************************************
// Copyright 2018-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include <memory>
#include "gtest/gtest.h"
#include "he_tensor.hpp"
#include "he_type.hpp"
#include "ngraph/ngraph.hpp"
#include "seal/he_seal_backend.hpp"
#include "seal/he_seal_executable.hpp"
#include "test_util.hpp"
#include "util/test_tools.hpp"
TEST(he_tensor, pack) {
auto backend = ngraph::runtime::Backend::create("HE_SEAL");
auto he_backend = static_cast<ngraph::he::HESealBackend*>(backend.get());
ngraph::Shape shape{2, 2};
ngraph::he::HETensor plain(ngraph::element::f32, shape, false, false, false,
*he_backend);
std::vector<ngraph::he::HEType> elements;
for (size_t i = 0; i < shape_size(shape); ++i) {
elements.emplace_back(ngraph::he::HEPlaintext({static_cast<double>(i)}),
false);
}
plain.data() = elements;
plain.pack();
EXPECT_TRUE(plain.is_packed());
EXPECT_EQ(plain.get_packed_shape(), (ngraph::Shape{1, 2}));
EXPECT_EQ(plain.get_batch_size(), 2);
EXPECT_EQ(plain.data().size(), 2);
for (size_t i = 0; i < 2; ++i) {
EXPECT_TRUE(plain.data(i).is_plaintext());
EXPECT_EQ(plain.data(i).get_plaintext().size(), 2);
}
EXPECT_EQ(plain.data(0).get_plaintext()[0], 0);
EXPECT_EQ(plain.data(0).get_plaintext()[1], 2);
EXPECT_EQ(plain.data(1).get_plaintext()[0], 1);
EXPECT_EQ(plain.data(1).get_plaintext()[1], 3);
}
TEST(he_tensor, unpack) {
auto backend = ngraph::runtime::Backend::create("HE_SEAL");
auto he_backend = static_cast<ngraph::he::HESealBackend*>(backend.get());
ngraph::Shape shape{2, 2};
ngraph::he::HETensor plain(ngraph::element::f32, shape, true, false, false,
*he_backend);
std::vector<ngraph::he::HEType> elements;
elements.emplace_back(ngraph::he::HEPlaintext(std::vector<double>{0, 1}),
false);
elements.emplace_back(ngraph::he::HEPlaintext(std::vector<double>{2, 3}),
false);
plain.data() = elements;
plain.unpack();
EXPECT_FALSE(plain.is_packed());
EXPECT_EQ(plain.get_packed_shape(), (ngraph::Shape{2, 2}));
EXPECT_EQ(plain.data().size(), 4);
EXPECT_EQ(plain.get_batch_size(), 1);
for (size_t i = 0; i < 4; ++i) {
EXPECT_TRUE(plain.data(i).is_plaintext());
EXPECT_EQ(plain.data(i).get_plaintext().size(), 1);
}
EXPECT_EQ(plain.data(0).get_plaintext()[0], 0);
EXPECT_EQ(plain.data(1).get_plaintext()[0], 2);
EXPECT_EQ(plain.data(2).get_plaintext()[0], 1);
EXPECT_EQ(plain.data(3).get_plaintext()[0], 3);
}
TEST(he_tensor, save) {
auto backend = ngraph::runtime::Backend::create("HE_SEAL");
auto he_backend = static_cast<ngraph::he::HESealBackend*>(backend.get());
auto parms =
ngraph::he::HESealEncryptionParameters::default_real_packing_parms();
he_backend->update_encryption_parameters(parms);
ngraph::Shape shape{2};
auto tensor = he_backend->create_plain_tensor(ngraph::element::f32, shape);
std::vector<float> tensor_data({5, 6});
copy_data(tensor, tensor_data);
auto he_tensor = std::static_pointer_cast<ngraph::he::HETensor>(tensor);
std::vector<ngraph::he::pb::HETensor> protos;
he_tensor->write_to_protos(protos);
EXPECT_EQ(protos.size(), 1);
const auto& proto = protos[0];
EXPECT_EQ(proto.name(), he_tensor->get_name());
std::vector<uint64_t> expected_shape{shape};
for (size_t shape_idx = 0; shape_idx < expected_shape.size(); ++shape_idx) {
EXPECT_EQ(proto.shape(shape_idx), expected_shape[shape_idx]);
}
EXPECT_EQ(proto.offset(), 0);
EXPECT_EQ(proto.packed(), he_tensor->is_packed());
EXPECT_EQ(proto.data_size(), he_tensor->data().size());
for (size_t i = 0; i < he_tensor->data().size(); ++i) {
EXPECT_TRUE(proto.data(i).is_plaintext());
std::vector<float> plain = {proto.data(i).plain().begin(),
proto.data(i).plain().end()};
EXPECT_EQ(plain.size(), 1);
EXPECT_FLOAT_EQ(plain[0], tensor_data[i]);
}
}
| 36.429688
| 79
| 0.64851
|
kthur
|
6c0b2820a9fd74e06aaefa76881747bc22c4e44f
| 249
|
cpp
|
C++
|
Src/Util/Mutex.cpp
|
jan-van-bergen/GPU-Pathtracer
|
a1538ea910c431ad35d0b3d6a9db42a9ec56516f
|
[
"MIT"
] | 235
|
2020-05-26T22:33:27.000Z
|
2022-02-08T22:25:57.000Z
|
Src/Util/Mutex.cpp
|
jan-van-bergen/GPU-Pathtracer
|
a1538ea910c431ad35d0b3d6a9db42a9ec56516f
|
[
"MIT"
] | 9
|
2020-09-16T12:55:36.000Z
|
2022-01-23T08:21:47.000Z
|
Src/Util/Mutex.cpp
|
jan-van-bergen/GPU-Pathtracer
|
a1538ea910c431ad35d0b3d6a9db42a9ec56516f
|
[
"MIT"
] | 12
|
2020-05-11T21:46:57.000Z
|
2022-01-28T17:46:13.000Z
|
#include "Mutex.h"
#include <mutex>
struct Impl { std::mutex mutex; };
void Mutex::init() {
impl = new Impl();
}
void Mutex::free() {
delete impl;
}
void Mutex::lock() {
impl->mutex.lock();
}
void Mutex::unlock() {
impl->mutex.unlock();
}
| 11.318182
| 34
| 0.606426
|
jan-van-bergen
|
6c0f5fee186f7576e3d6ef86ed35a3f1f58110d6
| 9,227
|
cxx
|
C++
|
Plugins/Mipf_Plugin_MitkStdWidgets/MultiViewsWidget/MultiViewsWidget.cxx
|
linson7017/MIPF
|
adf982ae5de69fca9d6599fbbbd4ca30f4ae9767
|
[
"ECL-2.0",
"Apache-2.0"
] | 4
|
2017-04-13T06:01:49.000Z
|
2019-12-04T07:23:53.000Z
|
Plugins/Mipf_Plugin_MitkStdWidgets/MultiViewsWidget/MultiViewsWidget.cxx
|
linson7017/MIPF
|
adf982ae5de69fca9d6599fbbbd4ca30f4ae9767
|
[
"ECL-2.0",
"Apache-2.0"
] | 1
|
2017-10-27T02:00:44.000Z
|
2017-10-27T02:00:44.000Z
|
Plugins/Mipf_Plugin_MitkStdWidgets/MultiViewsWidget/MultiViewsWidget.cxx
|
linson7017/MIPF
|
adf982ae5de69fca9d6599fbbbd4ca30f4ae9767
|
[
"ECL-2.0",
"Apache-2.0"
] | 2
|
2017-09-06T01:59:07.000Z
|
2019-12-04T07:23:54.000Z
|
#include "MultiViewsWidget.h"
#include "QmitkStdMultiWidget.h"
#include "mitkRenderingManager.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "mitkProperties.h"
#include "mitkRenderingManager.h"
#include "mitkPointSet.h"
#include "mitkPointSetDataInteractor.h"
#include "mitkImageAccessByItk.h"
#include "mitkRenderingManager.h"
#include "mitkDataStorage.h"
#include <mitkIOUtil.h>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QPushButton>
#include <QVBoxLayout>
#include <MitkMain/IQF_MitkDataManager.h>
#include <MitkMain/IQF_MitkRenderWindow.h>
#include "iqf_main.h"
#include "Utils/variant.h"
#include "Res/R.h"
#include "vtkXMLPolyDataReader.h"
#include "vtkTransformPolyDataFilter.h"
#include "vtkMath.h"
#include "Rendering/OrientationMarkerVtkMapper3D.h" \
#include "qf_log.h"
//##Documentation
//## @brief As MultiViews, but with QmitkStdMultiWidget as widget
MultiViewsWidget::MultiViewsWidget():MitkPluginView(),m_bInited(false), m_multiWidget(nullptr)
{
}
void MultiViewsWidget::CreateView()
{
Init(this);
}
void MultiViewsWidget::Update(const char* szMessage, int iValue, void* pValue)
{
if (strcmp(szMessage, "MITK_MESSAGE_MULTIVIEWS_ENABLE_ORIENTATION_MARKER") == 0)
{
}
}
void MultiViewsWidget::SetupWidgets()
{
//*************************************************************************
// Part I: Create windows and pass the tree to it
//*************************************************************************
// Create toplevel widget with vertical layout
QVBoxLayout *vlayout = new QVBoxLayout(this);
vlayout->setMargin(0);
vlayout->setSpacing(0);
// Create viewParent widget with horizontal layout
QWidget *viewParent = new QWidget(this);
vlayout->addWidget(viewParent);
QHBoxLayout *hlayout = new QHBoxLayout(viewParent);
hlayout->setMargin(0);
//*************************************************************************
// Part Ia: create and initialize QmitkStdMultiWidget
//*************************************************************************
m_multiWidget = new QmitkStdMultiWidget(viewParent);
hlayout->addWidget(m_multiWidget);
if (GetDataStorage())
{
// Tell the multiWidget which DataStorage to render
m_multiWidget->SetDataStorage(GetDataStorage());
// Initialize views as axial, sagittal, coronar (from
// top-left to bottom)
mitk::TimeGeometry::Pointer geo = GetDataStorage()->ComputeBoundingGeometry3D(GetDataStorage()->GetAll());
mitk::RenderingManager::GetInstance()->InitializeViews(geo);
}
// Initialize bottom-right view as 3D view
m_multiWidget->GetRenderWindow4()->GetRenderer()->SetMapperID(mitk::BaseRenderer::Standard3D);
// Enable standard handler for levelwindow-slider
m_multiWidget->EnableStandardLevelWindow();
// Add the displayed views to the DataStorage to see their positions in 2D and 3D
m_multiWidget->AddDisplayPlaneSubTree();
m_multiWidget->AddPlanesToDataStorage();
bool widgetPlanesVisible = true;
if (HasAttribute("widgetsVisible"))
{
widgetPlanesVisible = QString(GetAttribute("widgetsVisible")).compare("true", Qt::CaseInsensitive) == 0;
}
m_multiWidget->SetWidgetPlanesVisibility(widgetPlanesVisible);
m_multiWidget->DisableDepartmentLogo();
if (HasAttribute("logo"))
{
//QF_INFO << R::Instance()->getImageResourceUrl(GetAttribute("logo"));
m_multiWidget->SetDepartmentLogoPath(R::Instance()->getImageResourceUrl(GetAttribute("logo")).c_str());
m_multiWidget->EnableDepartmentLogo();
}
//set cross hair
int crosshairgapsize = GetMitkReferenceInterface()->GetInt("Crosshair-Gap-Size", 1);
if (HasAttribute("Crosshair-Gap-Size"))
{
crosshairgapsize = QString(GetAttribute("Crosshair-Gap-Size")).toInt();
}
m_multiWidget->GetWidgetPlane1()->SetIntProperty("Crosshair.Gap Size", crosshairgapsize);
m_multiWidget->GetWidgetPlane2()->SetIntProperty("Crosshair.Gap Size", crosshairgapsize);
m_multiWidget->GetWidgetPlane3()->SetIntProperty("Crosshair.Gap Size", crosshairgapsize);
//set orientation marker
if (HasAttribute("Orientation-Marker"))
{
mitk::DataNode* insideMarkerNode = GetDataStorage()->GetNamedNode("orientation marker");
if (insideMarkerNode)
{
insideMarkerNode->SetVisibility(true, m_multiWidget->GetRenderWindow1()->GetRenderer());
insideMarkerNode->SetVisibility(true, m_multiWidget->GetRenderWindow2()->GetRenderer());
insideMarkerNode->SetVisibility(true, m_multiWidget->GetRenderWindow3()->GetRenderer());
insideMarkerNode->SetVisibility(true, m_multiWidget->GetRenderWindow4()->GetRenderer());
return;
}
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
reader->SetFileName(R::Instance()->getImageResourceUrl(GetAttribute("Orientation-Marker")).c_str());
reader->Update();
vtkPolyData* polyData = reader->GetOutput();
if (polyData)
{
double bounds[6];
polyData->GetBounds(bounds);
double scale = 100.0/vtkMath::Max(vtkMath::Max(bounds[1] - bounds[0], bounds[3] - bounds[2]), bounds[5] - bounds[4]);
double center[3];
polyData->GetCenter(center);
vtkSmartPointer<vtkTransform> translation =
vtkSmartPointer<vtkTransform>::New();
translation->Scale(scale, scale, scale);
translation->Translate(-center[0],-center[1],-center[2]);
vtkSmartPointer<vtkTransformPolyDataFilter> transformFilter =
vtkSmartPointer<vtkTransformPolyDataFilter>::New();
transformFilter->SetInputData(polyData);
transformFilter->SetTransform(translation);
transformFilter->Update();
m_multiWidget->SetCornerAnnotationVisibility(false);
mitk::DataNode::Pointer markerNode = mitk::DataNode::New();
mitk::Surface::Pointer markerSurface = mitk::Surface::New();
markerSurface->SetVtkPolyData(transformFilter->GetOutput());
markerNode->SetData(markerSurface);
markerNode->SetBoolProperty("helper object", true);
markerNode->SetBoolProperty("includeInBoundingBox", false);
markerNode->SetName("orientation marker");
markerNode->SetVisibility(false);
markerNode->SetVisibility(true, m_multiWidget->GetRenderWindow1()->GetRenderer());
markerNode->SetVisibility(true, m_multiWidget->GetRenderWindow2()->GetRenderer());
markerNode->SetVisibility(true, m_multiWidget->GetRenderWindow3()->GetRenderer());
markerNode->SetVisibility(true, m_multiWidget->GetRenderWindow4()->GetRenderer());
mitk::OrientationMarkerVtkMapper3D::Pointer orientationMapper3D = mitk::OrientationMarkerVtkMapper3D::New();
markerNode->SetMapper(mitk::BaseRenderer::Standard3D, orientationMapper3D);
markerNode->SetMapper(mitk::BaseRenderer::Standard2D, orientationMapper3D);
orientationMapper3D->SetDataNode(markerNode);
GetDataStorage()->Add(markerNode);
}
}
if (HasAttribute("menuVisible"))
{
m_multiWidget->ActivateMenuWidget(QString(GetAttribute("menuVisible")).compare("true", Qt::CaseInsensitive) == 0);
}
}
void MultiViewsWidget::Init(QWidget* parent)
{
m_pMain->Attach(this);
// setup the widgets as in the previous steps, but with an additional
// QVBox for a button to start the segmentation
SetupWidgets();
IQF_MitkRenderWindow* pRenderWindow = (IQF_MitkRenderWindow*)m_pMain->GetInterfacePtr(QF_MitkMain_RenderWindow);
if (pRenderWindow)
{
pRenderWindow->SetMitkStdMultiWidget(m_multiWidget,GetAttribute("id"));
m_pMain->SendMessageQf(MITK_MESSAGE_MULTIWIDGET_INITIALIZED, 0, pRenderWindow);
}
}
void MultiViewsWidget::ChangeLayout(int index)
{
switch (index)
{
case 0:
{
m_multiWidget->changeLayoutToDefault();
break;
}
case 1:
{
m_multiWidget->changeLayoutToWidget1();
break;
}
case 2:
{
m_multiWidget->changeLayoutToWidget2();
break;
}
case 3:
{
m_multiWidget->changeLayoutToWidget3();
break;
}
case 4:
{
m_multiWidget->changeLayoutToBig3D();
break;
}
default:
break;
}
}
void MultiViewsWidget::ResetView()
{
m_multiWidget->ResetCrosshair();
}
void MultiViewsWidget::hideEvent(QHideEvent *e)
{
m_pMain->SendMessageQf(MITK_MESSAGE_MULTIWIDGET_HIDE, 0, m_multiWidget);
QWidget::hideEvent(e);
}
void MultiViewsWidget::showEvent(QShowEvent *e)
{
m_pMain->SendMessageQf(MITK_MESSAGE_MULTIWIDGET_SHOW, 0, m_multiWidget);
QWidget::showEvent(e);
}
void MultiViewsWidget::closeEvent(QCloseEvent *e)
{
m_pMain->SendMessageQf(MITK_MESSAGE_MULTIWIDGET_CLOSE, 0, m_multiWidget);
QWidget::closeEvent(e);
}
| 35.902724
| 129
| 0.66067
|
linson7017
|
6c11eec25354564f4f10c4c42946f459caffe75c
| 9,476
|
cpp
|
C++
|
Sourcecode/private/mx/core/ElementInterface.cpp
|
Webern/MxOld
|
822f5ccc92363ddff118e3aa3a048c63be1e857e
|
[
"MIT"
] | 45
|
2019-04-16T19:55:08.000Z
|
2022-02-14T02:06:32.000Z
|
Sourcecode/private/mx/core/ElementInterface.cpp
|
Webern/MxOld
|
822f5ccc92363ddff118e3aa3a048c63be1e857e
|
[
"MIT"
] | 70
|
2019-04-07T22:45:21.000Z
|
2022-03-03T15:35:59.000Z
|
Sourcecode/private/mx/core/ElementInterface.cpp
|
Webern/MxOld
|
822f5ccc92363ddff118e3aa3a048c63be1e857e
|
[
"MIT"
] | 21
|
2019-05-13T13:59:06.000Z
|
2022-03-25T02:21:05.000Z
|
// MusicXML Class Library
// Copyright (c) by Matthew James Briggs
// Distributed under the MIT License
#include "mx/core/ElementInterface.h"
#include "ezxml/XElement.h"
#include "ezxml/XElementIterator.h"
#include "ezxml/XFactory.h"
#include <sstream>
namespace mx
{
namespace core
{
const char* INDENT = " ";
ElementInterface::ElementInterface()
{
}
ElementInterface::~ElementInterface()
{
}
std::ostream& ElementInterface::streamOpenTag( std::ostream& os ) const
{
os << "<";
this->streamName( os );
if ( hasAttributes() )
{
streamAttributes( os );
}
os << ">";
return os;
}
std::ostream& ElementInterface::streamCloseTag( std::ostream& os ) const
{
os << "</";
this->streamName( os );
os << ">";
return os;
}
std::ostream& ElementInterface::streamSelfCloseTag( std::ostream& os ) const
{
os << "<";
this->streamName( os );
if ( hasAttributes() )
{
streamAttributes( os );
}
os << "/>";
return os;
}
bool ElementInterface::hasContents() const
{
std::stringstream ss;
bool discard;
streamContents( ss, 0, discard );
return ( ss.str() ).length() > 0;
}
std::ostream& ElementInterface::toStream( std::ostream& os, const int indentLevel ) const
{
indent( os, indentLevel );
if( myProcessingInstructions.empty() )
{
return streamWithoutProcessingInstructions( os, indentLevel );
}
else
{
std::stringstream ss;
streamWithoutProcessingInstructions( ss, 0 );
const auto xml = ss.str();
std::istringstream iss{ xml };
const auto xdoc = ::ezxml::XFactory::makeXDoc();
xdoc->loadStream( iss );
const auto root = xdoc->getRoot();
const bool hasChildren = root->getType() == ::ezxml::XElementType::element && root->begin() != root->end();
streamWithProcessingInstructions( os, indentLevel, hasChildren );
}
return os;
}
const std::string ElementInterface::getElementName() const
{
std::stringstream ss;
this->streamName( ss );
return ss.str();
}
std::ostream& indent( std::ostream& os, const int indentLevel )
{
for ( int i = 0; i < indentLevel; ++i )
{
os << INDENT;
}
return os;
}
bool ElementInterface::hasAttributes() const
{
return false;
}
bool ElementInterface::fromXElement( std::ostream& message, ::ezxml::XElement& xelement )
{
if( xelement.getIsProcessingInstruction() )
{
const auto next = xelement.getNextSibling();
if( next )
{
return this->fromXElement( message, *next );
}
}
const bool result = this->fromXElementImpl( message, xelement );
// check for processing instructions
if( xelement.getType() == ezxml::XElementType::element )
{
auto childIter = xelement.beginWithProcessingInstructions();
const auto childEnd = xelement.end();
while( childIter != childEnd && childIter->getIsProcessingInstruction() )
{
// inexplicably, the following line caused a bad address crash on msvc
// ProcessingInstruction pi{ childIter->getName(), childIter->getValue() };
// surely this is an msvc compiler bug? prove me wrong. anyway, we store
// the getName() and getValue() results in short-lived variables to work
// around the windows issue.
auto name = childIter->getName();
auto value = childIter->getValue();
ProcessingInstruction pi{ name, value };
pi.setIsChild( true );
addProcessingInstruction( std::move( pi ) );
++childIter;
}
}
auto lookahead = xelement.getNextSibling();
while( lookahead != nullptr && lookahead->getIsProcessingInstruction() )
{
ProcessingInstruction pi{ lookahead->getName(), lookahead->getValue() };
pi.setIsChild( false );
addProcessingInstruction( std::move( pi ) );
lookahead = lookahead->getNextSibling();
}
return result;
}
const ProcessingInstructions& ElementInterface::getProcessingInstructions() const
{
return myProcessingInstructions;
}
void ElementInterface::clearProcessingInstructions()
{
myProcessingInstructions.clear();
}
void ElementInterface::addProcessingInstruction( ProcessingInstruction inProcessingInstruction )
{
myProcessingInstructions.emplace_back( std::move( inProcessingInstruction ) );
}
std::ostream& operator<<( std::ostream& os, const ElementInterface& value )
{
return value.toStream( os, 0 );
}
std::ostream& ElementInterface::writeChildProcessingInstructions( std::ostream& os, const int indentLevel ) const
{
bool isFirst = true;
for( const auto& pi : myProcessingInstructions )
{
if( pi.getIsChild() )
{
if (!isFirst)
{
os << std::endl;
}
indent( os, indentLevel + 1 );
pi.toStream( os );
isFirst = false;
}
}
return os;
}
std::ostream& ElementInterface::writeSiblingProcessingInstructions( std::ostream& os, const int indentLevel ) const
{
bool isFirst = true;
for( const auto& pi : myProcessingInstructions )
{
if( !pi.getIsChild() )
{
if (!isFirst)
{
os << std::endl;
}
indent( os, indentLevel );
pi.toStream( os );
isFirst = false;
}
}
return os;
}
std::ostream& ElementInterface::writeAllProcessingInstructions( std::ostream& os, const int indentLevel ) const
{
bool isFirst = true;
for( const auto& pi : myProcessingInstructions )
{
if (!isFirst)
{
os << std::endl;
}
indent( os, indentLevel );
pi.toStream( os );
isFirst = false;
}
return os;
}
std::ostream& ElementInterface::streamWithoutProcessingInstructions( std::ostream& os, const int indentLevel ) const
{
const bool isSelfClosing = !hasContents();
if ( !isSelfClosing )
{
streamOpenTag( os );
bool isOneLineOnly = false;
streamContents( os, indentLevel, isOneLineOnly );
if ( !isOneLineOnly )
{
indent( os, indentLevel );
}
streamCloseTag( os );
}
else
{
streamSelfCloseTag( os );
}
return os;
}
std::ostream& ElementInterface::streamWithProcessingInstructions( std::ostream& os, const int indentLevel, const bool inHasChildren ) const
{
const bool isSelfClosing = !hasContents();
if ( !isSelfClosing )
{
streamOpenTag( os );
bool isOneLineOnly = false;
if( inHasChildren )
{
writeChildProcessingInstructions( os, indentLevel );
}
streamContents( os, indentLevel, isOneLineOnly );
if ( !isOneLineOnly )
{
indent( os, indentLevel );
}
streamCloseTag( os );
if( inHasChildren )
{
os << std::endl;
writeSiblingProcessingInstructions( os, indentLevel );
}
else
{
os << std::endl;
writeAllProcessingInstructions( os, indentLevel );
}
}
else
{
streamSelfCloseTag( os );
os << std::endl;
writeAllProcessingInstructions( os, indentLevel );
}
return os;
}
}
}
| 29.337461
| 147
| 0.469607
|
Webern
|
6c148adcabd11a2a58a27d6d4fac83edfc75cfba
| 1,689
|
cpp
|
C++
|
src/jacoTests/jaco_joint_states.cpp
|
jpmerc/perception3d
|
f0eef9271afdf9b9100448b88ae1921a97bbba88
|
[
"BSD-3-Clause"
] | null | null | null |
src/jacoTests/jaco_joint_states.cpp
|
jpmerc/perception3d
|
f0eef9271afdf9b9100448b88ae1921a97bbba88
|
[
"BSD-3-Clause"
] | null | null | null |
src/jacoTests/jaco_joint_states.cpp
|
jpmerc/perception3d
|
f0eef9271afdf9b9100448b88ae1921a97bbba88
|
[
"BSD-3-Clause"
] | null | null | null |
#include <ros/ros.h>
// PCL specific includes
#include <jaco_msgs/JointAngles.h>
#include <angles/angles.h>
#include <sensor_msgs/JointState.h>
ros::Publisher pub;
using namespace std;
int seq = 0;
void angles_callback(const jaco_msgs::JointAnglesConstPtr& input_fingers){
seq++;
const char* nameArgs[] = {"jaco_joint_1", "jaco_joint_2", "jaco_joint_3", "jaco_joint_4", "jaco_joint_5", "jaco_joint_6"};
std::vector<std::string> JointName(nameArgs, nameArgs+6);
sensor_msgs::JointState joint_state;
joint_state.header.seq = seq;
joint_state.name = JointName;
joint_state.position.resize(6);
joint_state.velocity.resize(6);
joint_state.effort.resize(6);
joint_state.position[0] = angles::normalize_angle(angles::from_degrees(input_fingers->Angle_J1));
joint_state.position[1] = angles::normalize_angle(angles::from_degrees(input_fingers->Angle_J2));
joint_state.position[2] = angles::normalize_angle(angles::from_degrees(input_fingers->Angle_J3));
joint_state.position[3] = angles::normalize_angle(angles::from_degrees(input_fingers->Angle_J4));
joint_state.position[4] = angles::normalize_angle(angles::from_degrees(input_fingers->Angle_J5));
joint_state.position[5] = angles::normalize_angle(angles::from_degrees(input_fingers->Angle_J6));
pub.publish(joint_state);
}
int main (int argc, char** argv)
{
// Initialize ROS
ros::init (argc, argv, "grasp");
ros::NodeHandle n;
ros::NodeHandle nh("~");
ros::Subscriber sub = n.subscribe ("/jaco/joint_angles", 1, angles_callback);
pub = n.advertise<sensor_msgs::JointState> ("/custom_jaco/joint_states",1);
ros::spin();
return 0;
}
| 31.277778
| 126
| 0.722321
|
jpmerc
|
6c15aa39f08f8964fec29ebb9269aeb25097ee7a
| 2,096
|
hpp
|
C++
|
Interface/plugininterface.hpp
|
MaxFork/Dynamic-Application
|
a5a5b8e1e572bd3686446252b20d1fd7cc3ae4d2
|
[
"MIT"
] | 7
|
2021-04-12T09:54:06.000Z
|
2021-12-24T19:33:41.000Z
|
Interface/plugininterface.hpp
|
MaxFork/Dynamic-Application
|
a5a5b8e1e572bd3686446252b20d1fd7cc3ae4d2
|
[
"MIT"
] | 1
|
2021-04-12T21:08:23.000Z
|
2021-12-02T22:44:08.000Z
|
Interface/plugininterface.hpp
|
MaxFork/Dynamic-Application
|
a5a5b8e1e572bd3686446252b20d1fd7cc3ae4d2
|
[
"MIT"
] | 2
|
2021-04-12T09:46:46.000Z
|
2021-04-12T12:37:57.000Z
|
#ifndef PLUGININTERFACE_HPP
#define PLUGININTERFACE_HPP
#include "common.hpp"
#include <vector>
#include <string>
#include <map>
//!JSON
#include "third-party/json/json.hpp"
//! TODO json configuration...
//! Add new feature for configuration plugins based on json file.
struct PluginDetail {
std::string name;
std::string description;
std::string version;
std::string author;
};
//!GLOBAL
using NameList = std::vector<std::string>;
using PluginList = std::vector<PluginDetail>;
using ErrorString = std::vector<std::string>;
//!JSON
using JSon = nlohmann::json;
using JSonException = nlohmann::detail::exception;
class PluginInterfaceImpl;
/*!
* \brief The PluginInterface class is exported from the mail library.
*/
class __project_export PluginInterface {
public:
//Return a static instance of this class
static PluginInterface& instance();
/*!
* \brief addDetail function sets all information of plugins.
* \param plist is type of PluginList [std::vector<PluginDetail>]
*/
void addDetail(const PluginList& plist);
/*!
* \brief addName function sets name of plugins.
* \param name of plugin.
*/
void addName(const std::string& name);
/*!
* \brief setError function sets message of error inside plugins.
* \param var is message of error.
*/
void setError(const std::string& var);
/*!
* \brief getDetail function gets detail from plugins.
* \return list of detail such as name, version and etc.
*/
const PluginList& getDetail() const;
/*!
* \brief getNames function gets name of plugins.
* \return list of plugin.
*/
const NameList& getNames() const;
/*!
* \brief getErrors function gets list of errors.
* \return list of errors as string [ErrorString : std::vector<std::string>].
*/
const ErrorString& getErrors() const;
private:
PluginInterface();
virtual ~PluginInterface();
PluginInterfaceImpl* m_pImpl = {nullptr};
NameList m_nameList;
PluginList m_pluginList;
ErrorString m_errors;
};
#endif // PLUGININTERFACE_HPP
| 23.818182
| 79
| 0.6875
|
MaxFork
|
6c17b988f44e3268ead9d80edcd644c75bae8556
| 1,241
|
hpp
|
C++
|
core/BpNodeLib.hpp
|
lkpworkspace/SoftwareFactory
|
578b7a7541b8e818097ca7948a1dbc7957e248ee
|
[
"MIT"
] | 2
|
2022-02-10T20:27:26.000Z
|
2022-03-10T01:21:50.000Z
|
core/BpNodeLib.hpp
|
lkpworkspace/SoftwareFactory
|
578b7a7541b8e818097ca7948a1dbc7957e248ee
|
[
"MIT"
] | null | null | null |
core/BpNodeLib.hpp
|
lkpworkspace/SoftwareFactory
|
578b7a7541b8e818097ca7948a1dbc7957e248ee
|
[
"MIT"
] | 1
|
2022-02-11T14:17:53.000Z
|
2022-02-11T14:17:53.000Z
|
#pragma once
#include <functional>
#include <unordered_map>
#include "BpModule.hpp"
#include "BpVariable.hpp"
namespace bp {
class BpNode;
class BpNodeEv;
class BpGraph;
class BpNodeLib
{
typedef std::shared_ptr<BpNodeEv> create_ev_node_t();
typedef std::shared_ptr<BpNode> create_base_node_t();
public:
BpNodeLib();
virtual ~BpNodeLib();
/* 创建函数Node */
std::shared_ptr<BpNode> CreateFuncNode(BpModuleFunc func_info,
std::vector<BpVariable>& args,
std::vector<BpVariable>& res);
/* 创建变量Node */
std::shared_ptr<BpNode> CreateVarNode(const std::string& var_name, BpVariable var, bool is_get);
/* 创建事件Node */
std::shared_ptr<BpNode> CreateEvNode(const std::string& name);
/* 创建分支结构Node */
std::shared_ptr<BpNode> CreateBaseNode(const std::string& name);
/* 获得节点(分支结构)目录 */
std::shared_ptr<BpContents> GetContents();
private:
std::shared_ptr<BpContents> _root_contents;
std::shared_ptr<BpContents> _ev_contents;
std::shared_ptr<BpContents> _base_contents;
std::unordered_map<std::string, std::function<create_ev_node_t>> _ev_nodes;
std::unordered_map<std::string, std::function<create_base_node_t>> _base_nodes;
};
} // namespace bp
| 28.204545
| 100
| 0.702659
|
lkpworkspace
|
6c209acbd8209397ce1063aa474ae436526766b3
| 2,514
|
hpp
|
C++
|
src/d2d/io/dsv_reader.hpp
|
alexander-at-github/d2d
|
304b4ab1b69ed336e558306f8ada64734798eab2
|
[
"BSD-3-Clause"
] | null | null | null |
src/d2d/io/dsv_reader.hpp
|
alexander-at-github/d2d
|
304b4ab1b69ed336e558306f8ada64734798eab2
|
[
"BSD-3-Clause"
] | null | null | null |
src/d2d/io/dsv_reader.hpp
|
alexander-at-github/d2d
|
304b4ab1b69ed336e558306f8ada64734798eab2
|
[
"BSD-3-Clause"
] | null | null | null |
#pragma once
#include <algorithm>
#include <fstream>
#include <string>
#include <vector>
#include "d2d/util/clo.hpp"
#include "d2d/util/utils.hpp"
namespace d2d { namespace io {
template<typename numeric_type>
class dsv_reader {
public:
dsv_reader(std::string infilename, bool filtercovered) :
infilename(infilename),
filtercovered(filtercovered) {
readfile();
}
std::string
get_input_file_path()
{
return infilename;
}
std::vector<d2d::util::triple<numeric_type> >
get_vertices()
{
return vertices;
}
std::vector<d2d::util::triple<numeric_type> >
get_normals()
{
return normals;
}
std::vector<numeric_type>
get_areas()
{
return areas;
}
std::vector<numeric_type>
get_sqrts_of_areas()
{
return d2d::util::foldl<std::vector<numeric_type>, numeric_type>
([](auto& acc, auto const& ee) {acc.push_back(std::sqrt(ee));
return acc;},
std::vector<numeric_type>{},
areas);
}
private:
void readfile()
{
auto lefttrim =
[](auto str){
str.erase(str.begin(),
std::find_if(str.begin(), str.end(),
[](int ch){return !std::isspace(ch);}));};
std::ifstream filestream(infilename.c_str());
std::string line;
while (std::getline(filestream, line)) {
lefttrim(line);
if (line[0] == '#') {
// The string in the variable line represents a comment
continue;
}
std::stringstream linestream;
linestream << line;
double xx, yy, zz;
double nx, ny, nz;
int32_t mid;
double area;
int32_t cover;
linestream >> xx >> yy >> zz >> nx >> ny
>> nz >> mid >> area >> cover;
if (filtercovered && cover != 0) {
// Skip that point. It is covered by another point on a finer level
continue;
}
vertices.push_back({xx, yy, zz});
normals.push_back({nx, ny, nz});
matIds.push_back(mid);
areas.push_back(area);
coverflags.push_back(cover);
}
filestream.close();
}
private:
std::string infilename;
bool filtercovered;
std::vector<d2d::util::triple<double> > vertices;
std::vector<d2d::util::triple<double> > normals;
std::vector<int32_t> matIds;
std::vector<double> areas;
std::vector<int32_t> coverflags;
};
}}
| 24.173077
| 77
| 0.560064
|
alexander-at-github
|
6c348194c80183a19e672dab21ace9b4eb50c4c9
| 1,846
|
cpp
|
C++
|
Geometry-Algorithms/Graham scan O(NlogN).cpp
|
Fresher001/Competitive-Programming-2
|
e1e953bb1d4ade46cc670b2d0432f68504538ed2
|
[
"MIT"
] | 86
|
2016-10-18T23:30:36.000Z
|
2022-01-09T21:57:34.000Z
|
Geometry-Algorithms/Graham scan O(NlogN).cpp
|
Fresher001/Competitive-Programming-2
|
e1e953bb1d4ade46cc670b2d0432f68504538ed2
|
[
"MIT"
] | 1
|
2018-04-13T09:38:36.000Z
|
2018-04-13T09:38:36.000Z
|
Geometry-Algorithms/Graham scan O(NlogN).cpp
|
Fresher001/Competitive-Programming-2
|
e1e953bb1d4ade46cc670b2d0432f68504538ed2
|
[
"MIT"
] | 39
|
2017-03-02T07:25:40.000Z
|
2020-12-14T12:13:50.000Z
|
#include <bits/stdc++.h>
using namespace std;
#define Point pair<double,double>
#define x first
#define y second
/**
< 0 for counter-clockwise (trigonometric)
= 0 for collinear
> 0 for clockwise (anti-trigonometric)
**/
double CCW(const Point& A, const Point& B, const Point& C)
{
return (C.x - A.x) * (B.y - A.y) - (C.y - A.y) * (B.x - A.x);
}
/// Points in the result will be listed in counter-clockwise order.
vector<Point> convexHull(vector<Point>& points)
{
int N = points.size();
int ind = 0;
/// basic case
if (N <= 3)
return points;
/// find lowest point (it belongs to the convex hull)
for (int i = 1; i < N; ++i)
if (points[i] < points[ind])
ind = i;
/// place it on the first position
swap(points[0], points[ind]);
/// sort points, using the lowset one, in counter-clockwise order (using c++ lambda)
sort(points.begin() + 1, points.end(),
[&](const Point A, const Point B) -> bool
{
return CCW(points[0], A, B) < 0;
}
);
/// works as a stack
vector<Point> hull(N);
int dim = 0;
for (int i = 0; i < N; ++i)
{
while (dim >= 2 && CCW(hull[dim - 2], hull[dim - 1], points[i]) >= 0) ///clockwise turn
dim--;
hull[dim++] = points[i];
}
hull.resize(dim);
return hull;
}
int main()
{
ifstream in("infasuratoare.in");
ofstream out("infasuratoare.out");
int N;
in >> N;
vector<Point> points(N);
for (int i = 0; i < N; ++i)
in >> points[i].x >> points[i].y;
vector<Point> hull = convexHull(points);
out << hull.size() << "\n";
for (int i = 0; i < (int)hull.size(); ++i)
{
out << fixed << setprecision(10);
out << hull[i].x << " " << hull[i].y << "\n";
}
return 0;
}
| 21.218391
| 95
| 0.524377
|
Fresher001
|
6c35b79708d02bde48e01a80c2529151cfbb4782
| 41,050
|
cpp
|
C++
|
external/pcl/ProcessInterface.cpp
|
AstrocatApp/AstrocatApp
|
0b3b33861260ed495bfcbd4c8601ab82ad247d37
|
[
"MIT"
] | 2
|
2021-03-12T08:36:37.000Z
|
2021-04-05T19:34:08.000Z
|
external/pcl/ProcessInterface.cpp
|
OzerOzdemir/AstrocatApp
|
8da06ab819bc71010daa921f7a2c214c200d1ad3
|
[
"MIT"
] | 9
|
2021-02-08T08:58:33.000Z
|
2021-10-07T05:16:07.000Z
|
external/pcl/ProcessInterface.cpp
|
OzerOzdemir/AstrocatApp
|
8da06ab819bc71010daa921f7a2c214c200d1ad3
|
[
"MIT"
] | 1
|
2021-02-05T06:40:16.000Z
|
2021-02-05T06:40:16.000Z
|
// ____ ______ __
// / __ \ / ____// /
// / /_/ // / / /
// / ____// /___ / /___ PixInsight Class Library
// /_/ \____//_____/ PCL 2.4.7
// ----------------------------------------------------------------------------
// pcl/ProcessInterface.cpp - Released 2020-12-17T15:46:35Z
// ----------------------------------------------------------------------------
// This file is part of the PixInsight Class Library (PCL).
// PCL is a multiplatform C++ framework for development of PixInsight modules.
//
// Copyright (c) 2003-2020 Pleiades Astrophoto S.L. All Rights Reserved.
//
// Redistribution and use in both source and binary forms, with or without
// modification, is permitted provided that the following conditions are met:
//
// 1. All redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. All redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
// of their contributors, may be used to endorse or promote products derived
// from this software without specific prior written permission. For written
// permission, please contact info@pixinsight.com.
//
// 4. All products derived from this software, in any form whatsoever, must
// reproduce the following acknowledgment in the end-user documentation
// and/or other materials provided with the product:
//
// "This product is based on software from the PixInsight project, developed
// by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
//
// Alternatively, if that is where third-party acknowledgments normally
// appear, this acknowledgment must be reproduced in the product itself.
//
// THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
// INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
// DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// ----------------------------------------------------------------------------
#include <pcl/AutoLock.h>
#include <pcl/ErrorHandler.h>
#include <pcl/GlobalSettings.h>
#include <pcl/Graphics.h>
#include <pcl/ImageWindow.h>
#include <pcl/KeyCodes.h> // for IsControlPressed()/IsCmdPressed()
#include <pcl/MetaModule.h>
#include <pcl/ProcessImplementation.h>
#include <pcl/ProcessInstance.h>
#include <pcl/ProcessInterface.h>
#include <pcl/Settings.h>
#include <pcl/api/APIInterface.h>
namespace pcl
{
// ----------------------------------------------------------------------------
ProcessInterface::ProcessInterface()
: Control( nullptr )
, MetaObject( Module )
{
if ( Module == nullptr )
throw Error( "ProcessInterface: Module not initialized - illegal ProcessInterface instantiation" );
}
// ----------------------------------------------------------------------------
// Private ctor. to create a null object
ProcessInterface::ProcessInterface( int )
: Control( nullptr )
, MetaObject( nullptr )
{
}
class NullInterface : public ProcessInterface
{
public:
NullInterface()
: ProcessInterface( -1 )
{
}
IsoString Id() const override
{
return IsoString();
}
MetaProcess* Process() const override
{
return nullptr;
}
};
ProcessInterface& ProcessInterface::Null()
{
static NullInterface* nullInterface = nullptr;
static Mutex mutex;
volatile AutoLock lock( mutex );
if ( nullInterface == nullptr )
nullInterface = new NullInterface();
return *nullInterface;
}
// ----------------------------------------------------------------------------
void ProcessInterface::ApplyInstance() const
{
ProcessImplementation* p = NewProcess();
if ( p != nullptr )
p->LaunchOnCurrentView();
}
// ----------------------------------------------------------------------------
void ProcessInterface::ApplyInstanceGlobal() const
{
ProcessImplementation* p = NewProcess();
if ( p != nullptr )
p->LaunchGlobal();
}
// ----------------------------------------------------------------------------
void ProcessInterface::Cancel()
{
/*
* Undocumented feature: Do not close the dynamic interface if the Control
* key (the Command key on macOS) is being pressed.
*/
ImageWindow::TerminateDynamicSession( !IsControlOrCmdPressed() );
}
// ----------------------------------------------------------------------------
bool ProcessInterface::BrowseDocumentation() const
{
const MetaProcess* P = Process();
if ( P != nullptr && P->CanBrowseDocumentation() )
return P->BrowseDocumentation();
return false;
}
// ----------------------------------------------------------------------------
bool ProcessInterface::Launch( unsigned flags )
{
return (*API->Global->LaunchProcessInterface)( reinterpret_cast<interface_handle>( this ), flags ) != api_false;
}
// ----------------------------------------------------------------------------
void ProcessInterface::BroadcastImageUpdated( const View& v )
{
(*API->Global->BroadcastImageUpdated)( v.handle, 0 ); // extra argument reserved for future use
}
// ----------------------------------------------------------------------------
void ProcessInterface::ProcessEvents( bool excludeUserInputEvents )
{
if ( Module != nullptr )
Module->ProcessEvents( excludeUserInputEvents );
}
// ----------------------------------------------------------------------------
void ProcessInterface::SaveGeometry() const
{
IsoString key = SettingsKey() + "Geometry/";
Point p = Position();
Rect cr = ClientRect();
Settings::Write( key + "Left", p.x );
Settings::Write( key + "Top", p.y );
Settings::Write( key + "Width", cr.Width() );
Settings::Write( key + "Height", cr.Height() );
}
bool ProcessInterface::RestoreGeometry()
{
IsoString key = SettingsKey() + "Geometry/";
Point p0 = Position(), p = p0;
Rect cr = ClientRect();
int width = cr.Width();
int height = cr.Height();
bool ok = Settings::Read( key + "Left", p.x ) &&
Settings::Read( key + "Top", p.y ) &&
Settings::Read( key + "Width", width ) &&
Settings::Read( key + "Height", height );
if ( ok )
{
bool changeWidth = width != cr.Width() && !IsFixedWidth();
bool changeHeight = height != cr.Height() && !IsFixedHeight();
if ( changeWidth || changeHeight )
Resize( changeWidth ? width : cr.Width(), changeHeight ? height : cr.Height() );
if ( p != p0 )
Move( p );
}
return ok;
}
void ProcessInterface::SetDefaultPosition()
{
int x = PixInsightSettings::GlobalInteger( "Workspace/PrimaryScreenCenterX" );
int y = PixInsightSettings::GlobalInteger( "Workspace/PrimaryScreenCenterY" );
Rect cr = ClientRect();
Move( x - (cr.Width() >> 1), y - (cr.Height() >> 1) );
}
// ----------------------------------------------------------------------------
// Process Interface Context
// ----------------------------------------------------------------------------
class InterfaceDispatcher
{
public:
static void api_func Initialize( interface_handle hi, control_handle hw )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->handle = hw;
reinterpret_cast<ProcessInterface*>( hi )->Initialize();
}
ERROR_HANDLER
}
static api_bool api_func Launch( interface_handle hi, meta_process_handle hP,
const_process_handle hp, api_bool* dynamic, uint32* flags )
{
#define iface reinterpret_cast<ProcessInterface*>( hi )
try
{
bool myDynamic;
unsigned myFlags;
const MetaProcess* P;
if ( hP != 0 )
P = reinterpret_cast<const MetaProcess*>( hP );
else
P = iface->Process();
if ( P == nullptr )
return api_false;
if ( iface->Launch( *P, reinterpret_cast<const ProcessImplementation*>( hp ), myDynamic, myFlags ) )
{
*dynamic = api_bool( myDynamic );
*flags = uint32( myFlags );
if ( iface->m_launchCount++ == 0 )
{
iface->LoadSettings();
if ( iface->IsAutoSaveGeometryEnabled() )
if ( !iface->RestoreGeometry() )
iface->SetDefaultPosition();
}
return api_true;
}
return api_false;
}
ERROR_HANDLER
return api_false;
#undef iface
}
static process_handle api_func NewProcess( const_interface_handle hi, meta_process_handle* hmp )
{
try
{
ProcessImplementation* p = reinterpret_cast<const ProcessInterface*>( hi )->NewProcess();
*hmp = (p != nullptr) ? p->Meta() : 0;
return p;
}
ERROR_HANDLER
return 0;
}
static process_handle api_func NewTestProcess( const_interface_handle hi, meta_process_handle* hmp )
{
try
{
ProcessImplementation* p = reinterpret_cast<const ProcessInterface*>( hi )->NewTestProcess();
*hmp = (p != nullptr) ? p->Meta() : 0;
return p;
}
ERROR_HANDLER
return 0;
}
static api_bool api_func ValidateProcess( const_interface_handle hi, const_process_handle hp,
char16_type* whyNot, uint32 maxLen )
{
try
{
String whyNotStr;
bool ok = reinterpret_cast<const ProcessInterface*>( hi )->ValidateProcess(
*reinterpret_cast<const ProcessImplementation*>( hp ), whyNotStr );
if ( !ok )
if ( !whyNotStr.IsEmpty() )
if ( whyNot != nullptr )
if ( maxLen > 0 )
whyNotStr.c_copy( whyNot, maxLen );
return api_bool( ok );
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func ImportProcess( interface_handle hi, const_process_handle hp )
{
try
{
return reinterpret_cast<ProcessInterface*>( hi )->ImportProcess(
*reinterpret_cast<const ProcessImplementation*>( hp ) );
}
ERROR_HANDLER
return api_false;
}
static void api_func ApplyInstance( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->ApplyInstance();
}
ERROR_HANDLER
}
static void api_func ApplyInstanceGlobal( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->ApplyInstanceGlobal();
}
ERROR_HANDLER
}
static void api_func Execute( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->Execute();
}
ERROR_HANDLER
}
static void api_func Cancel( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->Cancel();
}
ERROR_HANDLER
}
static void api_func BrowseDocumentation( interface_handle hi )
{
try
{
(void)reinterpret_cast<ProcessInterface*>( hi )->BrowseDocumentation();
}
ERROR_HANDLER
}
static void api_func RealTimePreviewUpdated( interface_handle hi, api_bool active )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->RealTimePreviewUpdated( active != api_false );
}
ERROR_HANDLER
}
static void api_func TrackViewUpdated( interface_handle hi, api_bool active )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->TrackViewUpdated( active != api_false );
}
ERROR_HANDLER
}
static void api_func EditPreferences( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->EditPreferences();
}
ERROR_HANDLER
}
static void api_func ResetInstance( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->ResetInstance();
}
ERROR_HANDLER
}
static api_bool api_func RequiresRealTimePreviewUpdate( const_interface_handle hi,
const_image_handle himg, const_view_handle hv,
int32 x0, int32 y0, int32 x1, int32 y1, int32 z )
{
try
{
UInt16Image image( const_cast<image_handle>( himg ) );
View view( hv );
return reinterpret_cast<const ProcessInterface*>( hi )->RequiresRealTimePreviewUpdate( image, view,
Rect( x0, y0, x1, y1 ), z );
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func GenerateRealTimePreview( const_interface_handle hi,
image_handle himg, const_view_handle hv,
int32 x0, int32 y0, int32 x1, int32 y1, int32 z,
char16_type* info, uint32 maxLen )
{
try
{
UInt16Image image( himg );
View view( hv );
String infoStr;
bool ok = reinterpret_cast<const ProcessInterface*>( hi )->GenerateRealTimePreview( image, view,
Rect( x0, y0, x1, y1 ), z, infoStr );
if ( !infoStr.IsEmpty() )
if ( info != nullptr )
if ( maxLen > 0 )
infoStr.c_copy( info, maxLen );
return api_bool( ok );
}
ERROR_HANDLER
return api_false;
}
static void CancelRealTimePreview( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->CancelRealTimePreview();
}
ERROR_HANDLER
}
static api_bool EnterDynamicMode( interface_handle hi )
{
try
{
return reinterpret_cast<ProcessInterface*>( hi )->EnterDynamicMode();
}
ERROR_HANDLER
return api_false;
}
static void ExitDynamicMode( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->ExitDynamicMode();
}
ERROR_HANDLER
}
static api_bool api_func DynamicMouseEnter( interface_handle hi, view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->DynamicMouseEnter( v );
return api_true;
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicMouseLeave( interface_handle hi, view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->DynamicMouseLeave( v );
return api_true;
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicMouseMove( interface_handle hi, view_handle hv,
double x, double y,
api_mouse_buttons buttons, api_key_modifiers modifiers )
{
try
{
View v( hv );
DPoint p( x, y );
reinterpret_cast<ProcessInterface*>( hi )->DynamicMouseMove( v, p, buttons, modifiers );
return api_true;
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicMousePress( interface_handle hi, view_handle hv,
double x, double y,
api_mouse_button button, api_mouse_buttons buttons,
api_key_modifiers modifiers )
{
try
{
View v( hv );
DPoint p( x, y );
reinterpret_cast<ProcessInterface*>( hi )->DynamicMousePress( v, p, button, buttons, modifiers );
return api_true;
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicMouseRelease( interface_handle hi, view_handle hv,
double x, double y,
api_mouse_button button, api_mouse_buttons buttons,
api_key_modifiers modifiers )
{
try
{
View v( hv );
DPoint p( x, y );
reinterpret_cast<ProcessInterface*>( hi )->DynamicMouseRelease( v, p, button, buttons, modifiers );
return api_true;
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicMouseDoubleClick( interface_handle hi, view_handle hv,
double x, double y,
api_mouse_buttons buttons, api_key_modifiers modifiers )
{
try
{
View v( hv );
DPoint p( x, y );
reinterpret_cast<ProcessInterface*>( hi )->DynamicMouseDoubleClick( v, p, buttons, modifiers );
return api_true;
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicKeyPress( interface_handle hi, view_handle hv,
api_key_code key, api_key_modifiers modifiers )
{
try
{
View v( hv );
return reinterpret_cast<ProcessInterface*>( hi )->DynamicKeyPress( v, key, modifiers );
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicKeyRelease( interface_handle hi, view_handle hv,
api_key_code key, api_key_modifiers modifiers )
{
try
{
View v( hv );
return reinterpret_cast<ProcessInterface*>( hi )->DynamicKeyRelease( v, key, modifiers );
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func DynamicMouseWheel( interface_handle hi, view_handle hv,
double x, double y, int32 wheelDelta,
api_mouse_buttons buttons, api_key_modifiers modifiers )
{
try
{
View v( hv );
DPoint p( x, y );
return reinterpret_cast<ProcessInterface*>( hi )->DynamicMouseWheel( v, p, wheelDelta, buttons, modifiers );
}
ERROR_HANDLER
return api_false;
}
static api_bool api_func RequiresDynamicUpdate( const_interface_handle hi, const_view_handle hv,
double x0, double y0, double x1, double y1 )
{
try
{
View v( hv );
DRect r( x0, y0, x1, y1 );
return reinterpret_cast<const ProcessInterface*>( hi )->RequiresDynamicUpdate( v, r );
}
ERROR_HANDLER
return api_false;
}
static void api_func DynamicPaint( const_interface_handle hi, const_view_handle hv, graphics_handle hg,
double x0, double y0, double x1, double y1 )
{
try
{
View v( hv );
VectorGraphics g( hg );
DRect r( x0, y0, x1, y1 );
reinterpret_cast<const ProcessInterface*>( hi )->DynamicPaint( v, g, r );
}
ERROR_HANDLER
}
// Notifications
static void api_func ImageCreated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageCreated( v );
}
ERROR_HANDLER
}
static void api_func ImageUpdated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageUpdated( v );
}
ERROR_HANDLER
}
static void api_func ImageRenamed( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageRenamed( v );
}
ERROR_HANDLER
}
static void api_func ImageDeleted( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageDeleted( v );
}
ERROR_HANDLER
}
static void api_func ImageFocused( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageFocused( v );
}
ERROR_HANDLER
}
static void api_func ImageLocked( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageLocked( v );
}
ERROR_HANDLER
}
static void api_func ImageUnlocked( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageUnlocked( v );
}
ERROR_HANDLER
}
static void api_func ImageSTFEnabled( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageSTFEnabled( v );
}
ERROR_HANDLER
}
static void api_func ImageSTFDisabled( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageSTFDisabled( v );
}
ERROR_HANDLER
}
static void api_func ImageSTFUpdated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageSTFUpdated( v );
}
ERROR_HANDLER
}
static void api_func ImageRGBWSUpdated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageRGBWSUpdated( v );
}
ERROR_HANDLER
}
static void api_func ImageCMEnabled( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageCMEnabled( v );
}
ERROR_HANDLER
}
static void api_func ImageCMDisabled( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageCMDisabled( v );
}
ERROR_HANDLER
}
static void api_func ImageCMUpdated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageCMUpdated( v );
}
ERROR_HANDLER
}
static void api_func ImageSaved( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->ImageSaved( v );
}
ERROR_HANDLER
}
static void api_func MaskUpdated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->MaskUpdated( v );
}
ERROR_HANDLER
}
static void api_func MaskEnabled( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->MaskEnabled( v );
}
ERROR_HANDLER
}
static void api_func MaskDisabled( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->MaskDisabled( v );
}
ERROR_HANDLER
}
static void api_func MaskShown( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->MaskShown( v );
}
ERROR_HANDLER
}
static void api_func MaskHidden( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->MaskHidden( v );
}
ERROR_HANDLER
}
static void api_func TransparencyHidden( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->TransparencyHidden( v );
}
ERROR_HANDLER
}
static void api_func TransparencyModeUpdated( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->TransparencyModeUpdated( v );
}
ERROR_HANDLER
}
static void api_func ViewPropertyUpdated( interface_handle hi, const_view_handle hv, const char* property )
{
try
{
View v( hv );
IsoString p( property );
reinterpret_cast<ProcessInterface*>( hi )->ViewPropertyUpdated( v, p );
}
ERROR_HANDLER
}
static void api_func ViewPropertyDeleted( interface_handle hi, const_view_handle hv, const char* property )
{
try
{
View v( hv );
IsoString p( property );
reinterpret_cast<ProcessInterface*>( hi )->ViewPropertyDeleted( v, p );
}
ERROR_HANDLER
}
static void api_func BeginReadout( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->BeginReadout( v );
}
ERROR_HANDLER
}
static void api_func UpdateReadout( interface_handle hi, const_view_handle hv,
double x, double y, double R, double G, double B, double A )
{
try
{
View v( hv );
DPoint p( x, y );
reinterpret_cast<ProcessInterface*>( hi )->UpdateReadout( v, p, R, G, B, A );
}
ERROR_HANDLER
}
static void api_func EndReadout( interface_handle hi, const_view_handle hv )
{
try
{
View v( hv );
reinterpret_cast<ProcessInterface*>( hi )->EndReadout( v );
}
ERROR_HANDLER
}
static void api_func ProcessCreated( interface_handle hi, const_process_handle hp )
{
try
{
ProcessInstance instance( hp );
reinterpret_cast<ProcessInterface*>( hi )->ProcessCreated( instance );
}
ERROR_HANDLER
}
static void api_func ProcessUpdated( interface_handle hi, const_process_handle hp )
{
try
{
ProcessInstance instance( hp );
reinterpret_cast<ProcessInterface*>( hi )->ProcessUpdated( instance );
}
ERROR_HANDLER
}
static void api_func ProcessDeleted( interface_handle hi, const_process_handle hp )
{
try
{
ProcessInstance instance( hp );
reinterpret_cast<ProcessInterface*>( hi )->ProcessDeleted( instance );
}
ERROR_HANDLER
}
static void api_func ProcessSaved( interface_handle hi, const_process_handle hp )
{
try
{
ProcessInstance instance( hp );
reinterpret_cast<ProcessInterface*>( hi )->ProcessSaved( instance );
}
ERROR_HANDLER
}
static void api_func RealTimePreviewOwnerChanged( interface_handle hi, interface_handle hi1 )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->RealTimePreviewOwnerChanged(
(hi1 != 0) ? *reinterpret_cast<ProcessInterface*>( hi1 ) : ProcessInterface::Null() );
}
ERROR_HANDLER
}
static void api_func RealTimePreviewLUTUpdated( interface_handle hi, int32 colorModel )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->RealTimePreviewLUTUpdated( colorModel );
}
ERROR_HANDLER
}
static void api_func RealTimePreviewGenerationStarted( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->RealTimePreviewGenerationStarted();
}
ERROR_HANDLER
}
static void api_func RealTimePreviewGenerationFinished( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->RealTimePreviewGenerationFinished();
}
ERROR_HANDLER
}
static void api_func GlobalRGBWSUpdated( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->GlobalRGBWSUpdated();
}
ERROR_HANDLER
}
static void api_func GlobalCMEnabled( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->GlobalCMEnabled();
}
ERROR_HANDLER
}
static void api_func GlobalCMDisabled( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->GlobalCMDisabled();
}
ERROR_HANDLER
}
static void api_func GlobalCMUpdated( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->GlobalCMUpdated();
}
ERROR_HANDLER
}
static void api_func ReadoutOptionsUpdated( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->ReadoutOptionsUpdated();
}
ERROR_HANDLER
}
static void api_func GlobalPreferencesUpdated( interface_handle hi )
{
try
{
reinterpret_cast<ProcessInterface*>( hi )->GlobalPreferencesUpdated();
}
ERROR_HANDLER
}
}; // InterfaceDispatcher
// ----------------------------------------------------------------------------
void ProcessInterface::PerformAPIDefinitions() const
{
(*API->InterfaceDefinition->EnterInterfaceDefinitionContext)();
{
IsoString id = Id();
(*API->InterfaceDefinition->BeginInterfaceDefinition)( this, id.c_str(), 0 );
}
(*API->InterfaceDefinition->SetInterfaceVersion)( Version() );
{
IsoString aliases = Aliases().Trimmed();
if ( !aliases.IsEmpty() )
(*API->InterfaceDefinition->SetInterfaceAliasIdentifiers)( aliases.c_str() );
}
{
String desc = Description();
if ( !desc.IsEmpty() )
(*API->InterfaceDefinition->SetInterfaceDescription)( desc.c_str() );
}
{
IsoString svg = IconImageSVG();
if ( !svg.IsEmpty() )
(*API->InterfaceDefinition->SetInterfaceIconSVG)( svg.c_str() );
else
{
String filePath = IconImageSVGFile();
if ( !filePath.IsEmpty() )
(*API->InterfaceDefinition->SetInterfaceIconSVGFile)( filePath.c_str() );
else
{
// ### DEPRECATED - Interface icon images in raster bitmap formats.
const char** xpm = IconImageXPM();
if ( xpm != nullptr )
(*API->InterfaceDefinition->SetInterfaceIconImage)( xpm );
else
{
String path = IconImageFile();
if ( !path.IsEmpty() )
(*API->InterfaceDefinition->SetInterfaceIconImageFile)( path.c_str() );
}
xpm = SmallIconImageXPM();
if ( xpm != nullptr )
(*API->InterfaceDefinition->SetInterfaceIconSmallImage)( xpm );
else
{
String path = SmallIconImageFile();
if ( !path.IsEmpty() )
(*API->InterfaceDefinition->SetInterfaceIconSmallImageFile)( path.c_str() );
}
}
}
}
(*API->InterfaceDefinition->SetInterfaceFeatures)( Features(), 0 );
(*API->InterfaceDefinition->SetInterfaceInitializationRoutine)( InterfaceDispatcher::Initialize );
(*API->InterfaceDefinition->SetInterfaceLaunchRoutine)( InterfaceDispatcher::Launch );
if ( IsInstanceGenerator() )
{
(*API->InterfaceDefinition->SetInterfaceProcessInstantiationRoutine)( InterfaceDispatcher::NewProcess );
if ( DistinguishesTestInstances() )
(*API->InterfaceDefinition->SetInterfaceProcessTestInstantiationRoutine)( InterfaceDispatcher::NewTestProcess );
}
if ( CanImportInstances() )
{
if ( RequiresInstanceValidation() )
(*API->InterfaceDefinition->SetInterfaceProcessValidationRoutine)( InterfaceDispatcher::ValidateProcess );
(*API->InterfaceDefinition->SetInterfaceProcessImportRoutine)( InterfaceDispatcher::ImportProcess );
}
(*API->InterfaceDefinition->SetInterfaceApplyRoutine)( InterfaceDispatcher::ApplyInstance );
(*API->InterfaceDefinition->SetInterfaceApplyGlobalRoutine)( InterfaceDispatcher::ApplyInstanceGlobal );
(*API->InterfaceDefinition->SetInterfaceExecuteRoutine)( InterfaceDispatcher::Execute );
(*API->InterfaceDefinition->SetInterfaceCancelRoutine)( InterfaceDispatcher::Cancel );
(*API->InterfaceDefinition->SetInterfaceBrowseDocumentationRoutine)( InterfaceDispatcher::BrowseDocumentation );
(*API->InterfaceDefinition->SetInterfaceRealTimePreviewUpdatedRoutine)( InterfaceDispatcher::RealTimePreviewUpdated );
(*API->InterfaceDefinition->SetInterfaceTrackViewUpdatedRoutine)( InterfaceDispatcher::TrackViewUpdated );
(*API->InterfaceDefinition->SetInterfaceEditPreferencesRoutine)( InterfaceDispatcher::EditPreferences );
(*API->InterfaceDefinition->SetInterfaceResetRoutine)( InterfaceDispatcher::ResetInstance );
(*API->InterfaceDefinition->SetInterfaceRealTimeUpdateQueryRoutine)( InterfaceDispatcher::RequiresRealTimePreviewUpdate );
(*API->InterfaceDefinition->SetInterfaceRealTimeGenerationRoutine)( InterfaceDispatcher::GenerateRealTimePreview );
(*API->InterfaceDefinition->SetInterfaceRealTimeCancelRoutine)( InterfaceDispatcher::CancelRealTimePreview );
if ( IsDynamicInterface() )
{
(*API->InterfaceDefinition->SetInterfaceDynamicModeEnterRoutine)( InterfaceDispatcher::EnterDynamicMode );
(*API->InterfaceDefinition->SetInterfaceDynamicModeExitRoutine)( InterfaceDispatcher::ExitDynamicMode );
(*API->InterfaceDefinition->SetInterfaceDynamicMouseEnterRoutine)( InterfaceDispatcher::DynamicMouseEnter );
(*API->InterfaceDefinition->SetInterfaceDynamicMouseLeaveRoutine)( InterfaceDispatcher::DynamicMouseLeave );
(*API->InterfaceDefinition->SetInterfaceDynamicMouseMoveRoutine)( InterfaceDispatcher::DynamicMouseMove );
(*API->InterfaceDefinition->SetInterfaceDynamicMousePressRoutine)( InterfaceDispatcher::DynamicMousePress );
(*API->InterfaceDefinition->SetInterfaceDynamicMouseReleaseRoutine)( InterfaceDispatcher::DynamicMouseRelease );
(*API->InterfaceDefinition->SetInterfaceDynamicMouseDoubleClickRoutine)( InterfaceDispatcher::DynamicMouseDoubleClick );
(*API->InterfaceDefinition->SetInterfaceDynamicKeyPressRoutine)( InterfaceDispatcher::DynamicKeyPress );
(*API->InterfaceDefinition->SetInterfaceDynamicKeyReleaseRoutine)( InterfaceDispatcher::DynamicKeyRelease );
(*API->InterfaceDefinition->SetInterfaceDynamicMouseWheelRoutine)( InterfaceDispatcher::DynamicMouseWheel );
(*API->InterfaceDefinition->SetInterfaceDynamicUpdateQueryRoutine)( InterfaceDispatcher::RequiresDynamicUpdate );
(*API->InterfaceDefinition->SetInterfaceDynamicPaintRoutine)( InterfaceDispatcher::DynamicPaint );
}
if ( WantsImageNotifications() )
{
(*API->InterfaceDefinition->SetImageCreatedNotificationRoutine)( InterfaceDispatcher::ImageCreated );
(*API->InterfaceDefinition->SetImageUpdatedNotificationRoutine)( InterfaceDispatcher::ImageUpdated );
(*API->InterfaceDefinition->SetImageRenamedNotificationRoutine)( InterfaceDispatcher::ImageRenamed );
(*API->InterfaceDefinition->SetImageDeletedNotificationRoutine)( InterfaceDispatcher::ImageDeleted );
(*API->InterfaceDefinition->SetImageFocusedNotificationRoutine)( InterfaceDispatcher::ImageFocused );
(*API->InterfaceDefinition->SetImageLockedNotificationRoutine)( InterfaceDispatcher::ImageLocked );
(*API->InterfaceDefinition->SetImageUnlockedNotificationRoutine)( InterfaceDispatcher::ImageUnlocked );
(*API->InterfaceDefinition->SetImageSTFEnabledNotificationRoutine)( InterfaceDispatcher::ImageSTFEnabled );
(*API->InterfaceDefinition->SetImageSTFDisabledNotificationRoutine)( InterfaceDispatcher::ImageSTFDisabled );
(*API->InterfaceDefinition->SetImageSTFUpdatedNotificationRoutine)( InterfaceDispatcher::ImageSTFUpdated );
(*API->InterfaceDefinition->SetImageRGBWSUpdatedNotificationRoutine)( InterfaceDispatcher::ImageRGBWSUpdated );
(*API->InterfaceDefinition->SetImageCMEnabledNotificationRoutine)( InterfaceDispatcher::ImageCMEnabled );
(*API->InterfaceDefinition->SetImageCMDisabledNotificationRoutine)( InterfaceDispatcher::ImageCMDisabled );
(*API->InterfaceDefinition->SetImageCMUpdatedNotificationRoutine)( InterfaceDispatcher::ImageCMUpdated );
(*API->InterfaceDefinition->SetImageSavedNotificationRoutine)( InterfaceDispatcher::ImageSaved );
}
if ( WantsMaskNotifications() )
{
(*API->InterfaceDefinition->SetMaskUpdatedNotificationRoutine)( InterfaceDispatcher::MaskUpdated );
(*API->InterfaceDefinition->SetMaskEnabledNotificationRoutine)( InterfaceDispatcher::MaskEnabled );
(*API->InterfaceDefinition->SetMaskDisabledNotificationRoutine)( InterfaceDispatcher::MaskDisabled );
(*API->InterfaceDefinition->SetMaskShownNotificationRoutine)( InterfaceDispatcher::MaskShown );
(*API->InterfaceDefinition->SetMaskHiddenNotificationRoutine)( InterfaceDispatcher::MaskHidden );
}
if ( WantsTransparencyNotifications() )
{
(*API->InterfaceDefinition->SetTransparencyHiddenNotificationRoutine)( InterfaceDispatcher::TransparencyHidden );
(*API->InterfaceDefinition->SetTransparencyModeUpdatedNotificationRoutine)( InterfaceDispatcher::TransparencyModeUpdated );
}
if ( WantsViewPropertyNotifications() )
{
(*API->InterfaceDefinition->SetViewPropertyUpdatedNotificationRoutine)( InterfaceDispatcher::ViewPropertyUpdated );
(*API->InterfaceDefinition->SetViewPropertyDeletedNotificationRoutine)( InterfaceDispatcher::ViewPropertyDeleted );
}
if ( WantsReadoutNotifications() )
{
(*API->InterfaceDefinition->SetBeginReadoutNotificationRoutine)( InterfaceDispatcher::BeginReadout );
(*API->InterfaceDefinition->SetUpdateReadoutNotificationRoutine)( InterfaceDispatcher::UpdateReadout );
(*API->InterfaceDefinition->SetEndReadoutNotificationRoutine)( InterfaceDispatcher::EndReadout );
}
if ( WantsProcessNotifications() )
{
(*API->InterfaceDefinition->SetProcessCreatedNotificationRoutine)( InterfaceDispatcher::ProcessCreated );
(*API->InterfaceDefinition->SetProcessUpdatedNotificationRoutine)( InterfaceDispatcher::ProcessUpdated );
(*API->InterfaceDefinition->SetProcessDeletedNotificationRoutine)( InterfaceDispatcher::ProcessDeleted );
(*API->InterfaceDefinition->SetProcessSavedNotificationRoutine)( InterfaceDispatcher::ProcessSaved );
}
if ( WantsRealTimePreviewNotifications() )
{
(*API->InterfaceDefinition->SetRealTimePreviewOwnerChangeNotificationRoutine)( InterfaceDispatcher::RealTimePreviewOwnerChanged );
(*API->InterfaceDefinition->SetRealTimePreviewLUTUpdatedNotificationRoutine)( InterfaceDispatcher::RealTimePreviewLUTUpdated );
(*API->InterfaceDefinition->SetRealTimePreviewGenerationStartNotificationRoutine)( InterfaceDispatcher::RealTimePreviewGenerationStarted );
(*API->InterfaceDefinition->SetRealTimePreviewGenerationFinishNotificationRoutine)( InterfaceDispatcher::RealTimePreviewGenerationFinished );
}
if ( WantsGlobalNotifications() )
{
(*API->InterfaceDefinition->SetGlobalRGBWSUpdatedNotificationRoutine)( InterfaceDispatcher::GlobalRGBWSUpdated );
(*API->InterfaceDefinition->SetGlobalCMEnabledNotificationRoutine)( InterfaceDispatcher::GlobalCMEnabled );
(*API->InterfaceDefinition->SetGlobalCMDisabledNotificationRoutine)( InterfaceDispatcher::GlobalCMDisabled );
(*API->InterfaceDefinition->SetGlobalCMUpdatedNotificationRoutine)( InterfaceDispatcher::GlobalCMUpdated );
(*API->InterfaceDefinition->SetReadoutOptionsUpdatedNotificationRoutine)( InterfaceDispatcher::ReadoutOptionsUpdated );
(*API->InterfaceDefinition->SetGlobalPreferencesUpdatedNotificationRoutine)( InterfaceDispatcher::GlobalPreferencesUpdated );
}
(*API->InterfaceDefinition->EndInterfaceDefinition)();
(*API->InterfaceDefinition->ExitInterfaceDefinitionContext)();
}
// ----------------------------------------------------------------------------
} // pcl
// ----------------------------------------------------------------------------
// EOF pcl/ProcessInterface.cpp - Released 2020-12-17T15:46:35Z
| 32.945425
| 147
| 0.620512
|
AstrocatApp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.