text:
// Code generated by go-swagger; DO NOT EDIT.

package t_r_a

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/minchao/go-ptx/rail/v2/models"
)

// TRAAPIDailyTrainInfo21492Reader is a Reader for the TRAAPIDailyTrainInfo21492 structure.
type TRAAPIDailyTrainInfo21492Reader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *TRAAPIDailyTrainInfo21492Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewTRAAPIDailyTrainInfo21492OK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 299:
		result := NewTRAAPIDailyTrainInfo21492Status299()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 304:
		result := NewTRAAPIDailyTrainInfo21492NotModified()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewTRAAPIDailyTrainInfo21492OK creates a TRAAPIDailyTrainInfo21492OK with default headers values
func NewTRAAPIDailyTrainInfo21492OK() *TRAAPIDailyTrainInfo21492OK {
	return &TRAAPIDailyTrainInfo21492OK{}
}

/* TRAAPIDailyTrainInfo21492OK describes a response with status code 200, with default header values.

Success
*/
type TRAAPIDailyTrainInfo21492OK struct {
	Payload []*models.PTXServiceDTORailSpecificationV2TRARailDailyTrainInfo
}

func (o *TRAAPIDailyTrainInfo21492OK) Error() string {
	return fmt.Sprintf("[GET /v2/Rail/TRA/DailyTrainInfo/TrainDate/{TrainDate}][%d] tRAApiDailyTrainInfo21492OK  %+v", 200, o.Payload)
}
func (o *TRAAPIDailyTrainInfo21492OK) GetPayload() []*models.PTXServiceDTORailSpecificationV2TRARailDailyTrainInfo {
	return o.Payload
}

func (o *TRAAPIDailyTrainInfo21492OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewTRAAPIDailyTrainInfo21492Status299 creates a TRAAPIDailyTrainInfo21492Status299 with default headers values
func NewTRAAPIDailyTrainInfo21492Status299() *TRAAPIDailyTrainInfo21492Status299 {
	return &TRAAPIDailyTrainInfo21492Status299{}
}

/* TRAAPIDailyTrainInfo21492Status299 describes a response with status code 299, with default header values.

加入參數'?health=true'即可查詢此API服務的健康狀態
*/
type TRAAPIDailyTrainInfo21492Status299 struct {
	Payload *models.PTXServiceDTOSharedSpecificationV3BaseDisplayHealth
}

func (o *TRAAPIDailyTrainInfo21492Status299) Error() string {
	return fmt.Sprintf("[GET /v2/Rail/TRA/DailyTrainInfo/TrainDate/{TrainDate}][%d] tRAApiDailyTrainInfo21492Status299  %+v", 299, o.Payload)
}
func (o *TRAAPIDailyTrainInfo21492Status299) GetPayload() *models.PTXServiceDTOSharedSpecificationV3BaseDisplayHealth {
	return o.Payload
}

func (o *TRAAPIDailyTrainInfo21492Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.PTXServiceDTOSharedSpecificationV3BaseDisplayHealth)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewTRAAPIDailyTrainInfo21492NotModified creates a TRAAPIDailyTrainInfo21492NotModified with default headers values
func NewTRAAPIDailyTrainInfo21492NotModified() *TRAAPIDailyTrainInfo21492NotModified {
	return &TRAAPIDailyTrainInfo21492NotModified{}
}

/* TRAAPIDailyTrainInfo21492NotModified describes a response with status code 304, with default header values.

服務端會在Response加上Last-Modified header，表示最近的更新時間。客戶端能利用此時間，於Request加上If-Modified-Since header，若沒有更新，服務端會回應304 StatusCode且空值Content
*/
type TRAAPIDailyTrainInfo21492NotModified struct {
}

func (o *TRAAPIDailyTrainInfo21492NotModified) Error() string {
	return fmt.Sprintf("[GET /v2/Rail/TRA/DailyTrainInfo/TrainDate/{TrainDate}][%d] tRAApiDailyTrainInfo21492NotModified ", 304)
}

func (o *TRAAPIDailyTrainInfo21492NotModified) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	return nil
}

repository: minchao/go-ptx

repo_name: minchao/go-ptx


text:
// Copyright (c) 2017-2022 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

//go:build windows

package main

import "fmt"

// UseSIGToReloadTemplates wraps (*WebUI).UseSIGToReloadTemplates for Windows
// systems, where there are no signals to use.
func (td *WebUI) UseSIGToReloadTemplates() {
	fmt.Println("Signals are unsupported on Windows.")
}

license: ISC

repository: dajohi/hardforkdemo

license_type: permissive

repo_name: dajohi/hardforkdemo

branch_name: refs/heads/master

extension: go


text:
@inproceedings{CSCM19,
author={Choo, Davin and  Soos, Mate and  A. Chai, Kian Ming and  Meel, Kuldeep S.},
title={BOSPHORUS: Bridging ANF and CNF Solvers},
month={3},
booktitle={Proceedings of Design, Automation, and Test in Europe(DATE)},
year={2019},
abstract={Algebraic Normal Form (ANF) and Conjunctive Normal Form (CNF) are commonly used to encode problems in Boolean algebra. ANFs are typically solved via Gr"obner basis algorithms, often using more memory than is feasible; while CNFs are solved using SAT solvers, which cannot exploit the algebra of polynomials naturally. We propose a paradigm that bridges between ANF and CNF solving techniques: the techniques are applied in an iterative manner to emph{learn facts} to augment the original problems. Experiments on over 1,100 benchmarks arising from four different applications domains demonstrate that learnt facts can significantly improve runtime and enable more benchmarks to be solved.},
}

license: MIT

repository: meelgroup/meelgroup-website

repo_name: meelgroup/meelgroup-website

gha_license_id: MIT

gha_language: TeX

extension: bib


text:
package Parser

import (
	"bytes"
	"fmt"
	"github.com/PuerkitoBio/goquery"
	"github.com/antchfx/htmlquery"
	"github.com/payne/awesomeCrawler/Engine"
	"log"
	"net/url"
	"regexp"
)

func RegexParseTag(content []byte) Engine.ParseResult {
	result := Engine.ParseResult{}
	re := regexp.MustCompile(`<td><a href="(.*?)">`)
	matches := re.FindAllSubmatch(content, -1)
	for _, m := range matches {
		result.Item = append(result.Item, m[1])
		result.Request = append(result.Request, Engine.Request{
			Method:    "GET",
			URL:       `https://book.douban.com/` + url.QueryEscape(string(m[1])),
			ParseFunc: Engine.NilParse,
		})
	}
	return result
}

//QueryParseTag use go query to parse txt
func QueryParseTag(content []byte) Engine.ParseResult {
	result := Engine.ParseResult{}
	doc, err := goquery.NewDocumentFromReader(bytes.NewReader(content))
	if err != nil {
		log.Printf("NewDocumentFromReader err: %s", err)
	}
	// Find the review items
	doc.Find("table tr td").Each(func(i int, s *goquery.Selection) {
		tag := s.Find("a").Text()
		log.Println(tag)
		result.Request = append(result.Request, Engine.Request{
			Method:    "GET",
			URL:       "https://book.douban.com/tag/" + url.QueryEscape(tag),
			ParseFunc: Engine.NilParse,
		})
	})
	return result
}

// XpathParseTag use html query to parse txt
func XpathParseTag(content []byte) Engine.ParseResult {
	result := Engine.ParseResult{}
	doc, err := htmlquery.Parse(bytes.NewReader(content))
	if err != nil {
		fmt.Printf("htmlquery Parse Error: %s", err)
	}
	nodes := htmlquery.Find(doc, `//table[@class='tagCol']//tr/td`)
	for _, node := range nodes {
		tagHref := htmlquery.Find(node, `./a`)
		tagTxt := htmlquery.Find(node, `./a`)
		href := htmlquery.SelectAttr(tagHref[0], `href`)
		txt := htmlquery.InnerText(tagTxt[0])

		log.Printf("Href:%s, Txt:%s \n", href, txt)
		result.Item = append(result.Item, txt)

		result.Request = append(result.Request, Engine.Request{
			Method:    "GET",
			URL:       "https://book.douban.com/" + url.QueryEscape(href),
			ParseFunc: Engine.NilParse,
		})
	}
	return result
}

repository: Golzaes/awesomeCrawler

repo_name: Golzaes/awesomeCrawler

gha_language: Go


text:
inherit esw_examples features_check

REQUIRED_MACHINE_FEATURES = "sysmonpsu"

ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmonpsu/examples/"

repository: Xilinx/meta-xilinx

repo_name: Xilinx/meta-xilinx

gha_language: C

extension: bb


text:
package deviceio

//
// Copyright 2020 Telenor Digital AS
//
// 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.
//
import (
	"fmt"
	"math/rand"
	"net"
	"testing"
	"time"

	"github.com/ExploratoryEngineering/logging"
	"github.com/eesrc/horde/pkg/deviceio/rxtx"
	"github.com/eesrc/horde/pkg/utils/grpcutil"
	"github.com/go-ocf/go-coap"
	"github.com/go-ocf/go-coap/codes"
	"github.com/stretchr/testify/require"
	"google.golang.org/grpc"
)

func coapSend(assert *require.Assertions, msg coap.Message, ep string) coap.Message {
	coapClient := coap.Client{Net: "udp"}
	coapConn, err := coapClient.Dial(ep)
	assert.NoError(err, "CoAP server should listen for requests")
	defer coapConn.Close()
	respMsg, err := coapConn.Exchange(msg)
	assert.NoError(err, "Exchange should be successful")
	return respMsg
}

// Test the CoAP server without any backend server. The server should
// accept request but respond with empty messages to the clients.
func TestCoAPNoServer(t *testing.T) {
	assert := require.New(t)

	port := 2048 + rand.Int31n(4096)
	config := CoAPParameters{
		Endpoint: fmt.Sprintf("127.0.0.1:%d", port),
		Protocol: "udp",
		APNID:    1,
		NASID:    "1",
		AuditLog: true,
	}
	grpcServerEndpoint := fmt.Sprintf("127.0.0.1:%d", 6144+rand.Int31n(1024))
	cc, err := grpcutil.NewGRPCClientConnection(grpcutil.GRPCClientParam{
		ServerEndpoint: grpcServerEndpoint,
	})
	assert.NoError(err, "Client connection should not return an error")
	client := rxtx.NewRxtxClient(cc)

	s := NewCoAPServer(client, config)
	assert.NotNil(s, "Server should be non-nil")
	assert.NoError(s.Start(), "Start() should be successful")
	defer s.Stop()

	assert.Error(s.Start(), "Start() a 2nd time should return error")

	// Do simple CoAP GET, POST, PUT, DELETE to the server. It should return
	// blank responses.

	// GET requests should return a Valid (but empty) response
	msg := coap.NewDgramMessage(coap.MessageParams{
		Type:      coap.Confirmable,
		Code:      codes.GET,
		MessageID: coap.GenerateMessageID(),
	})
	token, err := coap.GenerateToken()
	assert.NoError(err)
	msg.SetToken(token)
	msg.SetPath([]string{"one"})

	respMsg := coapSend(assert, msg, config.Endpoint)
	assert.Equal(codes.Valid, respMsg.Code())

	// POST requests should return a Created response.
	msg = coap.NewDgramMessage(coap.MessageParams{
		Type:      coap.Confirmable,
		Code:      codes.POST,
		MessageID: coap.GenerateMessageID(),
		Payload:   []byte("the POST"),
	})
	token, err = coap.GenerateToken()
	assert.NoError(err)
	msg.SetToken(token)
	msg.SetPath([]string{"one", "two"})
	msg.SetOption(coap.ContentFormat, coap.TextPlain)

	respMsg = coapSend(assert, msg, config.Endpoint)
	assert.Equal(codes.Created, respMsg.Code())

	// PUT request should do the same
	msg = coap.NewDgramMessage(coap.MessageParams{
		Type:      coap.Confirmable,
		Code:      codes.PUT,
		MessageID: coap.GenerateMessageID(),
		Payload:   []byte("the PUT"),
	})
	token, err = coap.GenerateToken()
	assert.NoError(err)
	msg.SetToken(token)
	msg.SetPath([]string{"one", "two", "three"})
	msg.SetOption(coap.ContentFormat, coap.TextPlain)

	respMsg = coapSend(assert, msg, config.Endpoint)
	assert.Equal(codes.Created, respMsg.Code())

	// DELETE requests (which will be ignored since they make no sense)
	// will still return a Delete response
	msg = coap.NewDgramMessage(coap.MessageParams{
		Type:      coap.Confirmable,
		Code:      codes.DELETE,
		MessageID: coap.GenerateMessageID(),
	})
	token, err = coap.GenerateToken()
	assert.NoError(err)
	msg.SetToken(token)
	msg.SetPath([]string{"one", "two", "three", "four"})

	respMsg = coapSend(assert, msg, config.Endpoint)
	assert.Equal(codes.Deleted, respMsg.Code())

	// If we bring up the dummy server it should receive upstream messages matching what we've put in
	dummyServer := newRxtxDummyServer()
	svr, err := grpcutil.NewGRPCServer(grpcutil.GRPCServerParam{
		Endpoint: grpcServerEndpoint,
	})
	assert.NoError(err, "Should not get error when launching grpc server")
	assert.NoError(svr.Launch(func(s *grpc.Server) {
		rxtx.RegisterRxtxServer(s, dummyServer)
	}, 500*time.Millisecond), "Should not get an error when launching the grpc server")
	defer svr.Stop()

	// Wait for the messages from the backlog is received. Should get all four
	// of them.
	assert.True(dummyServer.WaitForMessages(4, 5*time.Second))

	t.Logf("gRPC service runs @ port %s", grpcServerEndpoint)
}

// Test push for clients - create a client to feed messages, then accept
// them on the (device) side.
func TestCoAPPushMessages(t *testing.T) {
	logging.SetLogLevel(logging.DebugLevel)
	assert := require.New(t)

	port := 2048 + rand.Int31n(4096)
	config := CoAPParameters{
		Endpoint: fmt.Sprintf("127.0.0.1:%d", port),
		Protocol: "udp",
		APNID:    1,
		NASID:    "1",
		AuditLog: true,
	}
	grpcServerEndpoint := fmt.Sprintf("127.0.0.1:%d", 6144+rand.Int31n(1024))
	cc, err := grpcutil.NewGRPCClientConnection(grpcutil.GRPCClientParam{
		ServerEndpoint: grpcServerEndpoint,
	})
	assert.NoError(err, "Client connection should not return an error")
	client := rxtx.NewRxtxClient(cc)

	dummyServer := newRxtxDummyServer()
	svr, err := grpcutil.NewGRPCServer(grpcutil.GRPCServerParam{
		Endpoint: grpcServerEndpoint,
	})
	assert.NoError(err, "Should not get error when launching grpc server")
	assert.NoError(svr.Launch(func(s *grpc.Server) {
		rxtx.RegisterRxtxServer(s, dummyServer)
	}, 500*time.Millisecond), "Should not get an error when launching the grpc server")
	defer svr.Stop()

	s := NewCoAPServer(client, config)
	assert.NotNil(s, "Server should be non-nil")
	assert.NoError(s.Start(), "Start() should be successful")
	defer s.Stop()

	// Start the device server
	clientPort := 8192 + rand.Int31n(1024)
	assert.NoError(startClientListener(assert, fmt.Sprintf("127.0.0.1:%d", clientPort)))

	// Push GET, POST, DELETE, PUT to the device server

	// Do a GET
	dummyServer.send(rxtx.DownstreamResponse{
		Msg: &rxtx.Message{
			Id:            1,
			Type:          rxtx.MessageType_CoAPPush,
			Timestamp:     time.Now().UnixNano(),
			RemoteAddress: net.ParseIP("127.0.0.1"),
			RemotePort:    int32(clientPort),
			Coap: &rxtx.CoAPOptions{
				Token:          1,
				TimeoutSeconds: 1,
				Code:           int32(codes.GET),
				Path:           "/get",
				Accept:         int32(coap.AppLwm2mJSON),
				UriQuery:       []string{"foo", "bar"},
			},
		},
	})

	// The server should push the message through a PutMessage request to the
	// server. It should say "Valid" and "GET" in the payload.
	resp := dummyServer.receive(1 * time.Second)
	assert.NotNil(resp)
	assert.Equal(int32(codes.Valid), resp.Msg.Coap.Code)
	assert.Equal("GET", string(resp.Msg.Payload))

	// POST...
	dummyServer.send(rxtx.DownstreamResponse{
		Msg: &rxtx.Message{
			Id:            1,
			Type:          rxtx.MessageType_CoAPPush,
			Timestamp:     time.Now().UnixNano(),
			RemoteAddress: net.ParseIP("127.0.0.1"),
			RemotePort:    int32(clientPort),
			Payload:       []byte("Hello there"),
			Coap: &rxtx.CoAPOptions{
				Token:          1,
				TimeoutSeconds: 1,
				Code:           int32(codes.POST),
				Path:           "/post",
				Accept:         int32(coap.AppLwm2mJSON),
				ContentFormat:  int32(coap.AppLwm2mTLV),
				UriQuery:       []string{"foo", "bar"},
			},
		},
	})

	// The server should push the message through a PutMessage request to the
	// server. It should say "Created" and "POST" in the payload.
	resp = dummyServer.receive(1 * time.Second)
	assert.NotNil(resp)
	assert.Equal(int32(codes.Created), resp.Msg.Coap.Code)
	assert.Equal("POST", string(resp.Msg.Payload))

	// DELETE...
	dummyServer.send(rxtx.DownstreamResponse{
		Msg: &rxtx.Message{
			Id:            1,
			Type:          rxtx.MessageType_CoAPPush,
			Timestamp:     time.Now().UnixNano(),
			RemoteAddress: net.ParseIP("127.0.0.1"),
			RemotePort:    int32(clientPort),
			//			Payload:       []byte("Hello there"),
			Coap: &rxtx.CoAPOptions{
				Token:          1,
				TimeoutSeconds: 1,
				Code:           int32(codes.DELETE),
				Path:           "/delete",
				Accept:         int32(coap.AppLwm2mJSON),
				ContentFormat:  int32(coap.AppLwm2mTLV),
				UriQuery:       []string{"foo", "bar"},
			},
		},
	})

	resp = dummyServer.receive(1 * time.Second)
	assert.NotNil(resp)
	assert.Equal(int32(codes.Deleted), resp.Msg.Coap.Code)
	assert.Equal("DELETE", string(resp.Msg.Payload))
}

func startClientListener(assert *require.Assertions, ep string) error {
	mux := coap.NewServeMux()
	mux.DefaultHandleFunc(func(w coap.ResponseWriter, r *coap.Request) {
		assert.Fail("Did not expect that request")
	})
	mux.HandleFunc("/get", func(w coap.ResponseWriter, r *coap.Request) {
		w.SetCode(codes.Valid)
		w.Write([]byte("GET"))
	})
	mux.HandleFunc("/put", func(w coap.ResponseWriter, r *coap.Request) {
		w.SetCode(codes.Changed)
		w.Write([]byte("PUT"))
	})
	mux.HandleFunc("/post", func(w coap.ResponseWriter, r *coap.Request) {
		w.SetCode(codes.Created)
		w.Write([]byte("POST"))
	})
	mux.HandleFunc("/delete", func(w coap.ResponseWriter, r *coap.Request) {
		w.SetCode(codes.Deleted)
		w.Write([]byte("DELETE"))
	})
	errCh := make(chan error)
	go func(ch chan error) {
		if err := coap.ListenAndServe("udp", ep, mux, nil); err != nil {
			ch <- err
		}
	}(errCh)
	select {
	case e := <-errCh:
		return e
	case <-time.After(250 * time.Millisecond):
		// ok
	}
	return nil
}


text:
GPE_TARBALL_SUFFIX = "bz2"
inherit autotools gpe

PR          = "r1"
LICENSE     = "GPL"
DESCRIPTION = "GPE file manager"
DEPENDS     = "libgpewidget gnome-vfs dbus-glib"
SECTION = "gpe"
RDEPENDS_${PN}    = "gpe-icons"
RRECOMMENDS_${PN} = "gnome-vfs-plugin-file gnome-vfs-plugin-smb gnome-vfs-plugin-ftp gnome-vfs-plugin-computer gnome-vfs-plugin-network gnome-vfs-plugin-sftp gnome-vfs-plugin-http"

FILES_${PN} += " ${datadir}/gpe"

SRC_URI[md5sum] = "aecfb8d03fbfe11dfe6bc17db9591aee"
SRC_URI[sha256sum] = "6b4b4ee697472c7073e3ef9fa2e2ff89bcee07be452942814857cad3ef4f55ff"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
require python-django.inc
inherit setuptools3

SRC_URI[md5sum] = "30c688af9b63c4800ef9b044e0dd4145"
SRC_URI[sha256sum] = "84f370f6acedbe1f3c41e1a02de44ac206efda3355e427139ecb785b5f596d80"

RDEPENDS_${PN} += "\
    ${PYTHON_PN}-sqlparse \
"

repository: Kistler-Group/meta-openembedded

repo_name: Kistler-Group/meta-openembedded

gha_language: BitBake


text:
@inproceedings{basu2008bmcr,
 abstract = {In client-server interaction scenarios over a network the problem of unsolicited network transactions is often encountered. In this paper, we propose a reputation model based on the behavioural history of long-lived network client identities as a solution to this problem. The reputations of clients are shared between trusted servers anonymously through global reputation analysers. Shared global reputations and local reputations help servers to infer local opinions of clients and control service levels in attempts to reduce unsolicited network transactions.},
 address = {Trø ndheim, Norway},
 author = {Basu, Anirban and Wakeman, Ian and Chalmers, Dan and Robinson, Jon},
 booktitle = {Proceedings of Trust in Mobile Environments (workshop in IFIPTM 2008)},
 title = {A Behavioural Model for Client Reputation},
 url = {https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.8366&rep=rep1&type=pdf},
 year = {2008}
}


text:
@inproceedings{E14-2001,
 address = {Gothenburg, Sweden},
 author = {Eryi\u{g}it, G\"{u}l\c{s}en},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {1--4},
 publisher = {Association for Computational Linguistics},
 title = {ITU Turkish NLP Web Service},
 year = {2014}
}

@inproceedings{E14-2002,
 address = {Gothenburg, Sweden},
 author = {Agerri, Rodrigo  and  Bermudez, Josu  and  Rigau, German},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {5--8},
 publisher = {Association for Computational Linguistics},
 title = {Multilingual, Efficient and Easy NLP Processing with IXA Pipeline},
 year = {2014}
}

@inproceedings{E14-2003,
 address = {Gothenburg, Sweden},
 author = {Carreras, Xavier  and  Padr\'{o}, Llu\'{i}s  and  Zhang, Lei  and  Rettinger, Achim  and  Li, Zhixing  and  Garc\'{i}a-Cuesta, Esteban  and  Agi\'{c}, \v{Z}eljko  and  Bekavac, Bozo  and  Fortuna, Blaz  and  \v{S}tajner, Tadej},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {9--12},
 publisher = {Association for Computational Linguistics},
 title = {XLike Project Language Analysis Services},
 year = {2014}
}

@inproceedings{E14-2004,
 address = {Gothenburg, Sweden},
 author = {Zhang, Lei  and  Rettinger, Achim},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {13--16},
 publisher = {Association for Computational Linguistics},
 title = {Semantic Annotation, Analysis and Comparison: A Multilingual and Cross-lingual Text Analytics Toolkit},
 year = {2014}
}

@inproceedings{E14-2005,
 address = {Gothenburg, Sweden},
 author = {Nguyen, Dat Quoc  and  Nguyen, Dai Quoc  and  Pham, Dang Duc  and  Pham, Son Bao},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {17--20},
 publisher = {Association for Computational Linguistics},
 title = {RDRPOSTagger: A Ripple Down Rules-based Part-Of-Speech Tagger},
 year = {2014}
}

@inproceedings{E14-2006,
 address = {Gothenburg, Sweden},
 author = {Smit, Peter  and  Virpioja, Sami  and  Gr\"{o}nroos, Stig-Arne  and  Kurimo, Mikko},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {21--24},
 publisher = {Association for Computational Linguistics},
 title = {Morfessor 2.0: Toolkit for statistical morphological segmentation},
 year = {2014}
}

@inproceedings{E14-2007,
 address = {Gothenburg, Sweden},
 author = {Alabau, Vicent  and  Buck, Christian  and  Carl, Michael  and  Casacuberta, Francisco  and  Garc\'{i}a-Mart\'{i}nez, Mercedes  and  Germann, Ulrich  and  Gonz\'{a}lez-Rubio, Jes\'{u}s  and  Hill, Robin  and  Koehn, Philipp  and  Leiva, Luis  and  Mesa-Lao, Bartolom\'{e}  and  Ortiz-Mart\'{i}nez, Daniel  and  Saint-Amand, Herve  and  Sanchis Trilles, Germ\'{a}n  and  Tsoukala, Chara},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {25--28},
 publisher = {Association for Computational Linguistics},
 title = {CASMACAT: A Computer-assisted Translation Workbench},
 year = {2014}
}

@inproceedings{E14-2008,
 address = {Gothenburg, Sweden},
 author = {Freitag, Markus  and  Huck, Matthias  and  Ney, Hermann},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {29--32},
 publisher = {Association for Computational Linguistics},
 title = {Jane: Open Source Machine Translation System Combination},
 year = {2014}
}

@inproceedings{E14-2009,
 address = {Gothenburg, Sweden},
 author = {Centelles, Jordi  and  Costa-juss\`{a}, Marta R.  and  Banchs, Rafael E.},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {33--36},
 publisher = {Association for Computational Linguistics},
 title = {CHISPA on the GO: A mobile Chinese-Spanish translation service for travellers in trouble},
 year = {2014}
}

@inproceedings{E14-2010,
 address = {Gothenburg, Sweden},
 author = {Larsson, Staffan  and  Kronlid, Fredrik  and  W\"{a}rnest\r{a}l, Pontus},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {37--40},
 publisher = {Association for Computational Linguistics},
 title = {Safe In-vehicle Dialogue Using Learned Predictions of User Utterances},
 year = {2014}
}

@inproceedings{E14-2011,
 address = {Gothenburg, Sweden},
 author = {Angelov, Krasimir  and  Bringert, Bj\"{o}rn  and  Ranta, Aarne},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {41--44},
 publisher = {Association for Computational Linguistics},
 title = {Speech-Enabled Hybrid Multilingual Translation for Mobile Devices},
 year = {2014}
}

@inproceedings{E14-2012,
 address = {Gothenburg, Sweden},
 author = {Ortiz-Mart\'{i}nez, Daniel  and  Casacuberta, Francisco},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {45--48},
 publisher = {Association for Computational Linguistics},
 title = {The New Thot Toolkit for Fully-Automatic and Interactive Statistical Machine Translation},
 year = {2014}
}

@inproceedings{E14-2013,
 address = {Gothenburg, Sweden},
 author = {Bosca, Alessio  and  Nikoulina, Vassilina  and  Dymetman, Marc},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {49--52},
 publisher = {Association for Computational Linguistics},
 title = {A Lightweight Terminology Verification Service for External Machine Translation Engines},
 year = {2014}
}

@inproceedings{E14-2014,
 address = {Gothenburg, Sweden},
 author = {Jakub\'{i}\v{c}ek, Milo\v{s}  and  Kilgarriff, Adam  and  Kov\'{a}\v{r}, Vojtěch  and  Rychl\'{y}, Pavel  and  Suchomel, V\'{i}t},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {53--56},
 publisher = {Association for Computational Linguistics},
 title = {Finding Terms in Corpora for Many Languages with the Sketch Engine},
 year = {2014}
}

@inproceedings{E14-2015,
 address = {Gothenburg, Sweden},
 author = {Thiele, Gregor  and  Seeker, Wolfgang  and  G\"{a}rtner, Markus  and  Bj\"{o}rkelund, Anders  and  Kuhn, Jonas},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {57--60},
 publisher = {Association for Computational Linguistics},
 title = {A Graphical Interface for Automatic Error Mining in Corpora},
 year = {2014}
}

@inproceedings{E14-2016,
 address = {Gothenburg, Sweden},
 author = {Derczynski, Leon  and  Field, Camilla Vilhelmsen  and  B{\o}gh, Kenneth S.},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {61--64},
 publisher = {Association for Computational Linguistics},
 title = {DKIE: Open Source Information Extraction for Danish},
 year = {2014}
}

@inproceedings{E14-2017,
 address = {Gothenburg, Sweden},
 author = {Zavarella, Vanni  and  Kucuk, Dilek  and  Tanev, Hristo  and  H\"{u}rriyeto\u{g}lu, Ali},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {65--68},
 publisher = {Association for Computational Linguistics},
 title = {Event Extraction for Balkan Languages},
 year = {2014}
}

@inproceedings{E14-2018,
 address = {Gothenburg, Sweden},
 author = {Rizov, Borislav  and  Dekova, Rositsa},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {69--72},
 publisher = {Association for Computational Linguistics},
 title = {Anaphora -- Clause Annotation and Alignment Tool.},
 year = {2014}
}

@inproceedings{E14-2019,
 address = {Gothenburg, Sweden},
 author = {Delmonte, Rodolfo  and  Prati, Anton Maria},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {73--76},
 publisher = {Association for Computational Linguistics},
 title = {SPARSAR: An Expressive Poetry Reader},
 year = {2014}
}

@inproceedings{E14-2020,
 address = {Gothenburg, Sweden},
 author = {Toledo, Assaf  and  Alexandropoulou, Stavroula  and  Chesney, Sophie  and  Grimm, Robert  and  Kokke, Pepijn  and  Kruit, Benno  and  Neophytou, Kyriaki  and  Nguyen, Antony  and  Winter, Yoad},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {77--80},
 publisher = {Association for Computational Linguistics},
 title = {Annotating by Proving using SemAnTE},
 year = {2014}
}

@inproceedings{E14-2021,
 address = {Gothenburg, Sweden},
 author = {Gon\c{c}alves, Patricia  and  Branco, Antonio},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {81--84},
 publisher = {Association for Computational Linguistics},
 title = {Answering List Questions using Web as a corpus},
 year = {2014}
}

@inproceedings{E14-2022,
 address = {Gothenburg, Sweden},
 author = {Schl\"{o}gl, Stephan  and  Milhorat, Pierrick  and  Chollet, G\'{e}rard  and  Boudy, J\'{e}r\^{o}me},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {85--88},
 publisher = {Association for Computational Linguistics},
 title = {Designing Language Technology Applications: A Wizard of Oz Driven Prototyping Framework},
 year = {2014}
}

@inproceedings{E14-2023,
 address = {Gothenburg, Sweden},
 author = {Roth, Benjamin  and  Barth, Tassilo  and  Chrupa{\l}a, Grzegorz  and  Gropp, Martin  and  Klakow, Dietrich},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {89--92},
 publisher = {Association for Computational Linguistics},
 title = {RelationFactory: A Fast, Modular and Effective System for Knowledge Base Population},
 year = {2014}
}

@inproceedings{E14-2024,
 address = {Gothenburg, Sweden},
 author = {Kope\'{c}, Mateusz},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {93--96},
 publisher = {Association for Computational Linguistics},
 title = {MMAX2 for coreference annotation},
 year = {2014}
}

@inproceedings{E14-2025,
 address = {Gothenburg, Sweden},
 author = {Bontcheva, Kalina  and  Roberts, Ian  and  Derczynski, Leon  and  Rout, Dominic},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {97--100},
 publisher = {Association for Computational Linguistics},
 title = {The GATE Crowdsourcing Plugin: Crowdsourcing Annotated Corpora Made Easy},
 year = {2014}
}

@inproceedings{E14-2026,
 address = {Gothenburg, Sweden},
 author = {Braslavski, Pavel  and  Ustalov, Dmitry  and  Mukhin, Mikhail},
 booktitle = {Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics},
 month = {April},
 pages = {101--104},
 publisher = {Association for Computational Linguistics},
 title = {A Spinning Wheel for YARN: User Interface for a Crowdsourced Thesaurus},
 year = {2014}
}


text:
package lru_io

import (
	"encoding/json"
	"io"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"strings"
	"sync"
)

type LRUIO struct {
}

var instance *LRUIO
var once sync.Once

func GetInstance() *LRUIO {
	once.Do(func() {
		instance = &LRUIO{}
	})
	return instance
}

func (i *LRUIO) PathExists(path string) bool {
	_, err := os.Stat(path)
	if err == nil {
		return true
	}
	if os.IsNotExist(err) {
		return false
	}
	return false
}

func (i *LRUIO) CopyFile(src string, dst string) error {
	srcFile, errSrc := os.Open(src)
	if errSrc != nil {
		return errSrc
	}
	return i.CopyFileFromReader(srcFile, dst)
}

func (i *LRUIO) CopyFileFromReader(srcFile io.Reader, dst string) error {
	dirPath, _ := path.Split(dst)
	if !i.PathExists(dirPath) {
		dstDirErr := os.MkdirAll(dirPath, os.ModePerm)
		if dstDirErr != nil {
			return dstDirErr
		}
	}
	dstFile, errDstCreate := os.Create(dst)
	if errDstCreate != nil {
		return errDstCreate
	}
	defer dstFile.Close()
	_, errDestCopy := io.Copy(dstFile, srcFile)
	if errDestCopy != nil {
		return errDestCopy
	}
	return nil
}

func (i *LRUIO) CopyDir(src string, dest string) error {
	err := filepath.Walk(src, func(currentSrc string, f os.FileInfo, err error) error {
		if f == nil {
			return err
		}
		aimPath := strings.Replace(currentSrc, src, dest, 1)
		if !f.IsDir() {
			i.CopyFile(currentSrc, aimPath)
		}
		return nil
	})
	if err != nil {
		return err
	}
	return nil
}

func (i *LRUIO) JsonToStruct(jsonSrc string, obj interface{}) error {
	data, readErr := ioutil.ReadFile(jsonSrc)
	if readErr != nil {
		return readErr
	}
	parseErr := json.Unmarshal(data, obj)
	if parseErr != nil {
		return parseErr
	}
	return nil
}

func (i *LRUIO) GetRuntimePath(filename string) string {
	dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
	return filepath.Join(dir, filename)
}

func (i *LRUIO) ReplaceStrToFile(content, path string) error {
	if i.PathExists(path) {
		err := os.Remove(path)
		if err != nil {
			return err
		}
	}
	file, err := os.Create(path)
	if err != nil {
		return err
	}
	defer file.Close()
	_, wErr := file.WriteString(content)
	if wErr != nil {
		return wErr
	}
	return nil
}

repository: lemon-robot/lemon-robot-golang-commons

repo_name: lemon-robot/lemon-robot-golang-commons


text:
@inproceedings{li2006towards,
  title={Towards a Unified Theory of State Abstraction for MDPs},
  author={Li, Lihong and Walsh, Thomas J and Littman, Michael L},
  booktitle={ISAIM},
  year={2006}
}

@article{ferns2006methods,
  title={Methods for computing state similarity in Markov decision processes},
  author={Ferns, Norman and Castro, Pablo Samuel and Precup, Doina and Panangaden, Prakash},
  journal={Proceedings of the 22nd conference on Uncertainty in artificial intelligence},
  year={2006}
}

@inproceedings{ferns2004metrics,
  title={Metrics for finite Markov decision processes},
  author={Ferns, Norm and Panangaden, Prakash and Precup, Doina},
  booktitle={Proceedings of the 20th conference on Uncertainty in artificial intelligence},
  pages={162--169},
  year={2004},
  organization={AUAI Press}
}

@inproceedings{chentanez2004intrinsically,
  title={Intrinsically motivated reinforcement learning},
  author={Chentanez, Nuttapong and Barto, Andrew G and Singh, Satinder P},
  booktitle={Advances in Neural Information Processing Systems},
  pages={1281--1288},
  year={2004}
}

@inproceedings{dearden1998bayesian,
  title={Bayesian {Q}-learning},
  author={Dearden, Richard and Friedman, Nir and Russell, Stuart},
  booktitle={AAAI/IAAI},
  pages={761--768},
  year={1998}
}

@inproceedings{konidaris2007building,
  title={Building Portable Options: Skill Transfer in Reinforcement Learning.},
  author={Konidaris, George and Barto, Andrew G},
  booktitle={IJCAI},
  volume={7},
  pages={895--900},
  year={2007}
}

@article{sutton1999between,
  title={Between {MDP}s and semi-{MDP}s: A framework for temporal abstraction in reinforcement learning},
  author={Sutton, Richard S and Precup, Doina and Singh, Satinder},
  journal={Artificial Intelligence},
  volume={112},
  number={1},
  pages={181--211},
  year={1999},
  publisher={Elsevier}
}

@article{kaelbling1996reinforcement,
  title={Reinforcement learning: A survey},
  author={Kaelbling, Leslie Pack and Littman, Michael L and Moore, Andrew W},
  journal={Journal of Artificial Intelligence Research},
  pages={237--285},
  year={1996}
}

@inproceedings{anand2015novel,
  title={A Novel Abstraction Framework for Online Planning},
  author={Anand, Ankit and Grover, Aditya and Singla, Parag and others},
  booktitle={Proceedings of the 2015 International Conference on Autonomous Agents and Multiagent Systems},
  pages={1901--1902},
  year={2015},
  organization={International Foundation for Autonomous Agents and Multiagent Systems}
}

@inproceedings{ortner2007logarithmic,
  title={Logarithmic online regret bounds for undiscounted reinforcement learning},
  author={Ortner, P and Auer, R},
  booktitle={Proceedings of the 2006 Conference on Advances in Neural Information Processing Systems},
  volume={19},
  pages={49},
  year={2007}
}

@book{sutton1998reinforcement,
  title={Reinforcement Learning: An Introduction},
  author={Sutton, Richard S and Barto, Andrew G},
  year={1998},
  publisher={MIT Press}
}

@article{graphstream,
  author    = {Yoann Pign{\'{e}} and
               Antoine Dutot and
               Fr{\'{e}}d{\'{e}}ric Guinand and
               Damien Olivier},
  title     = {GraphStream: {A} Tool for bridging the gap between Complex Systems
               and Dynamic Graphs},
  journal   = {CoRR},
  volume    = {abs/0803.2093},
  year      = {2008},
}

@article{ortner2013adaptive,
  title={Adaptive aggregation for reinforcement learning in average reward {M}arkov decision processes},
  author={Ortner, Ronald},
  journal={Annals of Operations Research},
  volume={208},
  number={1},
  pages={321--336},
  year={2013},
  publisher={Springer}
}

@article{strehl2009reinforcement,
  title={Reinforcement learning in finite {MDP}s: {PAC} analysis},
  author={Strehl, Alexander L and Li, Lihong and Littman, Michael L},
  journal={Journal of Machine Learning Research},
  volume={10},
  pages={2413--2444},
  year={2009},
  publisher={JMLR. org}
}

@article{dietterich2000hierarchical,
  title={Hierarchical reinforcement learning with the MAXQ value function decomposition},
  author={Dietterich, Thomas G},
  journal={J. Artif. Intell. Res.(JAIR)},
  volume={13},
  pages={227--303},
  year={2000}
}

@inproceedings{littman1995complexity,
  title={On the complexity of solving {M}arkov decision problems},
  author={Littman, Michael L and Dean, Thomas L and Kaelbling, Leslie Pack},
  booktitle={Proceedings of the Eleventh Conference on Uncertainty in Artificial Intelligence},
  pages={394--402},
  year={1995},
  organization={Morgan Kaufmann Publishers Inc.}
}

@article{papadimitriou1987complexity,
  title={The complexity of {M}arkov decision processes},
  author={Papadimitriou, Christos H and Tsitsiklis, John N},
  journal={Mathematics of Operations Research},
  volume={12},
  number={3},
  pages={441--450},
  year={1987},
  publisher={INFORMS}
}

@incollection{even2003approximate,
  title={Approximate equivalence of {M}arkov decision processes},
  author={Even-Dar, Eyal and Mansour, Yishay},
  booktitle={Learning Theory and Kernel Machines},
  pages={581--594},
  year={2003},
  publisher={Springer}
}

@article{Jiang2015,
author = {Jiang, Nan},
title = {{Abstraction Selection in Model-Based Reinforcement Learning}},
volume = {37},
year = {2015}
}

@inproceedings{andre2002state,
  title={State abstraction for programmable reinforcement learning agents},
  author={Andre, David and Russell, Stuart J},
  booktitle={AAAI/IAAI},
  pages={119--125},
  year={2002}
}

@article{ravindran2003smdp,
  title={{SMDP} homomorphisms: An algebraic approach to abstraction in semi {M}arkov decision processes},
  author={Ravindran, Balaraman},
  year={2003}
}

@inproceedings{jiang2015abstraction,
  title={Abstraction Selection in Model-based Reinforcement Learning},
  author={Jiang, Nan and Kulesza, Alex and Singh, Satinder},
  booktitle={Proceedings of The 32nd International Conference on Machine Learning},
  pages={179--188},
  year={2015}
}

@inproceedings{jong2005state,
  title={State Abstraction Discovery from Irrelevant State Variables.},
  author={Jong, Nicholas K and Stone, Peter},
  booktitle={IJCAI},
  pages={752--757},
  year={2005},
}

@inproceedings{ortner2014selecting,
  title={Selecting near-optimal approximate state representations in reinforcement learning},
  author={Ortner, Ronald and Maillard, Odalric-Ambrym and Ryabko, Daniil},
  booktitle={Algorithmic Learning Theory},
  pages={140--154},
  year={2014},
  organization={Springer}
}

@inproceedings{maillard2011selecting,
  title={Selecting the state-representation in reinforcement learning},
  author={Maillard, Odalric-Ambrym and Ryabko, Daniil and Munos, R{\'e}mi},
  booktitle={Advances in Neural Information Processing Systems},
  pages={2627--2635},
  year={2011}
}

@article{Bean2011,
author = {Bean, James C and Birge, John R and Smith, Robert L},
journal = {Operations Research},
number = {2},
pages = {215--220},
title = {Dynamic programming aggregation},
volume = {35},
year = {2011}
}

@inproceedings{odalric2013optimal,
  title={Optimal regret bounds for selecting the state representation in reinforcement learning},
  author={Odalric-Ambrym, Maillard and Nguyen, Phuong and Ortner, Ronald and Ryabko, Daniil},
  booktitle={Proceedings of the Thirtieth International Conference on Machine Learning},
  year={2013}
}

@inproceedings{auer2009near,
  title={Near-optimal regret bounds for reinforcement learning},
  author={Auer, Peter and Jaksch, Thomas and Ortner, Ronald},
  booktitle={Advances in Neural Information Processing Systems},
  pages={89--96},
  year={2009}
}

@article{dietterich2000hierarchical,
  title={Hierarchical reinforcement learning with the {MAXQ} value function decomposition},
  author={Dietterich, Thomas G},
  journal={Journal of Artificial Intelligence Research},
  volume={13},
  pages={227--303},
  year={2000}
}

@article{Boutilier2000,
author = {Boutilier, C and Dearden, Richard and Goldszmidt, M},
issn = {0004-3702},
journal = {Artificial Intelligence},
number = {1-2},
pages = {49--107},
title = {{Stochastic dynamic programming with factored representations}},
volume = {121},
year = {2000}
}

@inproceedings{dean1997model,
  title={Model reduction techniques for computing approximately optimal solutions for Markov decision processes},
  author={Dean, Thomas and Givan, Robert and Leach, Sonia},
  booktitle={Proceedings of the Thirteenth Conference on Uncertainty in Artificial Intelligence},
  pages={124--131},
  year={1997},
  organization={Morgan Kaufmann Publishers Inc.}
}

@article{dearden1997abstraction,
  title={Abstraction and approximate decision-theoretic planning},
  author={Dearden, Richard and Boutilier, Craig},
  journal={Artificial Intelligence},
  volume={89},
  number={1},
  pages={219--283},
  year={1997},
  publisher={Elsevier}
}

@inproceedings{dean1997modelmin,
  title={Model minimization in Markov decision processes},
  author={Dean, Thomas and Givan, Robert},
  booktitle={AAAI/IAAI},
  pages={106--111},
  year={1997}
}

@book{russell1995modern,
  title={Artificial Intelligence A Modern Approach},
  author={Russell, Stuart and Norvig, Peter},
  year={1995},
  publisher={Prentice-Hall, Englewood Cliffs}
}

@inproceedings{abel2015goal,
  title={Goal-Based Action Priors.},
  author={Abel, David and Hershkowitz, David Ellis and Barth-Maron, Gabriel and Brawner, Stephen and O'Farrell, Kevin and MacGlashan, James and Tellex, Stefanie},
  booktitle={ICAPS},
  pages={306--314},
  year={2015}
}


text:
package httperr

import (
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"reflect"
	"strings"
	"testing"
)

func TestServeNoError(t *testing.T) {
	req := httptest.NewRequest("GET", "/test", nil)
	w := httptest.NewRecorder()
	NewF(func(w http.ResponseWriter, r *http.Request) error {
		return nil
	}).ServeHTTP(w, req)
	resp := w.Result()

	if resp.StatusCode != http.StatusOK {
		t.Fatalf("expected http status ok, got %d", resp.StatusCode)
	}
}

func TestServeHTTPError(t *testing.T) {
	req := httptest.NewRequest("GET", "/test", nil)
	w := httptest.NewRecorder()
	status := http.StatusBadRequest
	msg := "data was wrong"
	NewF(func(w http.ResponseWriter, r *http.Request) error {
		return Error{
			Status: status,
			Err:    fmt.Errorf(msg),
		}
	}).ServeHTTP(w, req)
	resp := w.Result()
	if resp.StatusCode != status {
		t.Fatalf("expected http status %d, got %d", status, resp.StatusCode)
	}

	bts, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		t.Fatalf("got error: %v", err)
	}
	if !strings.Contains(string(bts), msg) {
		t.Fatalf("%q does not contain %q", string(bts), msg)
	}
}

func TestServeError(t *testing.T) {
	req := httptest.NewRequest("GET", "/test", nil)
	w := httptest.NewRecorder()
	msg := "server is doing funky stuff"
	NewF(func(w http.ResponseWriter, r *http.Request) error {
		return fmt.Errorf(msg)
	}).ServeHTTP(w, req)
	resp := w.Result()

	status := http.StatusInternalServerError
	if resp.StatusCode != status {
		t.Fatalf("expected http status %d, got %d", status, resp.StatusCode)
	}

	bts, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		t.Fatalf("got error: %v", err)
	}
	if !strings.Contains(string(bts), msg) {
		t.Fatalf("%q does not contain %q", string(bts), msg)
	}
}

func TestWrap(t *testing.T) {
	type args struct {
		err    error
		status int
	}
	tests := []struct {
		name    string
		args    args
		wantErr bool
	}{
		{
			name: "nil err",
			args: args{
				err:    nil,
				status: 400,
			},
			wantErr: false,
		},
		{
			name: "nonnil err",
			args: args{
				err:    fmt.Errorf("errr"),
				status: 404,
			},
			wantErr: true,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			err := Wrap(tt.args.err, tt.args.status)
			if tt.wantErr {
				if err == nil {
					t.Fatalf("expected error, got none")
				}
			} else {
				if err != nil {
					t.Fatalf("expected no error, got %v", err)
				}
			}
		})
	}
}

func TestErrorIs(t *testing.T) {
	t.Run("outer", func(t *testing.T) {
		if !errors.Is(Wrap(io.EOF, http.StatusGone), Error{}) {
			t.Fatalf("underlying error should be Error")
		}
	})

	t.Run("is", func(t *testing.T) {
		if !errors.Is(Wrap(io.EOF, http.StatusGone), io.EOF) {
			t.Fatalf("underlying error should be io.EOF")
		}
	})

	t.Run("is not", func(t *testing.T) {
		if errors.Is(Wrap(io.ErrUnexpectedEOF, http.StatusGone), io.EOF) {
			t.Fatalf("underlying error should not be io.EOF")
		}
	})
}

func TestErrorf(t *testing.T) {
	err := Errorf(http.StatusConflict, "foo bar %d", 10)
	expectedErr := Error{
		Err:    fmt.Errorf("foo bar 10"),
		Status: http.StatusConflict,
	}

	if !reflect.DeepEqual(err, expectedErr) {
		t.Fatalf("errors does not match: %v", err)
	}
}

branch_name: refs/heads/main